I
I
Igor Dmitriev2019-05-25 17:54:56
JavaScript
Igor Dmitriev, 2019-05-25 17:54:56

How to compile Vue components into different JS/CSS files using Webpack?

For example, there are two vue components:

HomeComponent.vue
BlogComponent.vue

It is required that when compiling, Webpack separates the components into different files:
js/home.js
js/blog.js
css/home.css
css/blog.css

Who faced this issue, please tell me the code for webpack.mix.js. Now it has a standard compilation into one file:
mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css');

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Kitaev, 2019-05-25
@deliro

study

S
Sergey Ananiev, 2019-05-26
@yoj_nc

Why such an approach? Compile components?!

N
Nikita Peterson, 2017-06-04
@Designik_by

Add another column to your table that will store the link or page id. and it will be possible to add a condition to the query WHERE page=$_SERVER['REQUEST_URI'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question