-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Make sure that imported css files in SFCs are autoprefixed, too #1053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When using postcss-loader, we have to adjust the `importLoaders` setting in css-loader to re-apply the previous loaders on imported files. Without this setting, imports in css files will be read as plain css instead of being re-run through postcss, which I think is undesirable. This is my first, untested attempt. If any postcss(-loader) guru can chime in, help is welcome.
LinusBorg
commented
Nov 13, 2017
template/build/utils.js
Outdated
@@ -31,6 +34,10 @@ exports.cssLoaders = function (options) { | |||
|
|||
// generate loader string to be used with extract text plugin | |||
function generateLoaders (loader, loaderOptions) { | |||
let importLoaders = 0 | |||
if (options.usePostCSS) importLoaders++ | |||
if (options.usePostCSS && loader) importLoaders++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually I think we don't need this since preprocessors (SASS, LESS, Stylus) will handle @import
themselves, so there won't be any left for css-loader to care about.
const importLoaders = options.usePostCSS && !loader ? 1 : 0
that should be enough.
This works for all combinations - imports in .js, imports in .vue, nested imports in .css
c0defre4k
added a commit
to neonblack-at/webpack
that referenced
this pull request
Nov 17, 2017
* vuejs-templates/master: (54 commits) v1.2.3 remove double FriendlyErrorsPlugin (fix vuejs-templates#1064) v 1.2.2 remove unnecessary minimize option (close vuejs-templates#1056) Make sure that imported css files in SFCs are autoprefixed, too (vuejs-templates#1053) reduce clientLogLevel remove `express` from package.json (vuejs-templates#1060) Remove extra commas (vuejs-templates#1050) 1.2.1 - Bugfix release (vuejs-templates#1052) bumb version string in config in package.json bumb version string in config re-add postcss-loader Fix typos and formatting (vuejs-templates#1048) fix(jest): fix Jest coverage directory (vuejs-templates#1046) Remove unnecessary whitespaces (vuejs-templates#1047) re-merge (vuejs-templates#1045) Set ExtractTextPlugin.allChunks to true (vuejs-templates#1027) pass cssSourceMap option to vue-loader (vuejs-templates#756) Grammar and typo fixes on docs (vuejs-templates#992) Use webpack 3's standard way to generate a manifest in CommonsChunkPlugin (vuejs-templates#1028) ... # Conflicts: # meta.js # template/config/index.js # template/index.html # template/package.json
frandiox
pushed a commit
to OnsenUI/vue-cordova-webpack
that referenced
this pull request
Dec 25, 2017
…s-templates#1053) using postcss-import
shenron
pushed a commit
to shenron/webpack
that referenced
this pull request
Mar 20, 2018
…s-templates#1053) using postcss-import
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using postcss-loader, we have to adjust the
importLoaders
setting in css-loader to re-apply the previous loaders on imported files.Without this setting, imports in css files will be read as plain css instead of being re-run through postcss, which I think is undesirable.
This is my first, untested attempt.
If any postcss(-loader) guru can chime in, help is welcome.