extractVueStyles breaks multiple css files processing
See original GitHub issueMix:
const mix = require('laravel-mix');
mix.options({
extractVueStyles: true
});
const stylusOptons = {
paths: ['node_modules', 'resources/assets/stylus'],
'include css': true,
'resolve url': true
};
mix.setPublicPath('./public/assets');
mix.stylus('resources/assets/stylus/home.styl', 'css', stylusOptons);
mix
.stylus('resources/assets/stylus/vote/main.styl', 'css/vote', stylusOptons)
.stylus('resources/assets/stylus/vote/alter.styl', 'css/vote', stylusOptons)
.stylus('resources/assets/stylus/vote/order.styl', 'css/vote', stylusOptons)
.stylus('resources/assets/stylus/vote/open.styl', 'css/vote', stylusOptons);
mix
.sourceMaps()
.js('resources/assets/js/app.js', 'js')
.js('resources/assets/js/ui.js', 'js')
.extract(['vue', 'vuex', 'vue-resource'])
.stylus('resources/assets/stylus/app.styl', 'css', stylusOptons)
.copy('resources/assets/images', 'public/assets/images', false)
.copy('resources/assets/fonts', 'public/assets/fonts', false);
Enabling extractVueStyles
is leading to situation, when extracted styles are placed in each and every outputted css.
Probably extractVueStyles
should accept not a bool, but a path where to extract styles, or extracting should place styles near js file, from what they are extracted (e.g. app.js.css
).
At current point this simply doesn’t work as expected and breaks everything
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:20 (9 by maintainers)
Top Results From Across the Web
extractVueStyles breaks multiple css files processing #425
Enabling extractVueStyles is leading to situation, when extracted styles are placed in each and every outputted css. Probably extractVueStyles ...
Read more >Single huge .css file vs. multiple smaller specific .css files?
I've settled on using separate files in my design time, and a build process to minify and combine. This way I can have...
Read more >Laravel Mix Options
extractVueStyles : Extract .vue component styling (CSS within <style> tags) to a dedicated file, rather than inlining it into the HTML.
Read more >Breaking Up Large Files Into Sections | CSS-Tricks
If your authored files are already too long, can you find a way to break it apart that makes sense? If you can,...
Read more >Organizing your CSS - Learn web development | MDN
Break large stylesheets into multiple smaller ones. In cases where you have very different styles for distinct parts of the site, you might...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JeffreyWay about multiple mix.js() calls — maybe it will be easier to make possible to use several mix-files?
e.g.
npm run dev --mix=mymix
In most cases developer will have no need to build several scripts or style sets. And the way mix is built — it is aiming the most common case in most easy way. And the problem described can appear in cases of some specific complex apps. I don’t see an easy solution to this problem instead of two ways:
webpack.mix.js
,app.mix.js
,admin.mix.js
) — this seems to be the easiest and clear, but will force to call several build commands and will pollute root directoryThis will keep root dir clean, you will still use one command to build, but seems to be harder to implement and also can lead to mix-file overbloat (but not a big deal, I think, can be handled with imports)
Experiencing the same situation when I have two separated apps say, main and admin. Both are using Vue stack and I need to extract the css from two JS entries.
Since the
extractVueStyles
is expecting a file name for the extraced css and it uses extract-text-webpack-plugin, so I tried to pass a pattern instead of exact filename like thisand I got this
I wonder if it possible to pass a function or object to
extractVueStyles
so we could do something like thisToughts?