How to use in combination with gulp-sass
See original GitHub issueHi,
Im trying to use gulp-autoprefixer in combination with gulp-sass and gulp-sourcemaps. My gulpfile task looks like this:
gulp.task('sass', function () {
gulp.src( config.SASS.src )
.pipe( plugins.sourcemaps.init() )
.pipe( plugins.sass() )
.pipe( plugins.autoprefixer (
"last 1 versions", "> 10%", "ie 9"
))
.pipe( plugins.sourcemaps.write('./') )
.pipe( gulp.dest( config.SASS.build ) )
.pipe( browserSync.reload({ stream: true }) );
});
The plugins.
prefix is related to gulp-load-plugins
Without gulp-sass the task runs fine, but with it it throws the following error:
[08:26:51] Finished 'sass' after 3.32 ms
gulp-sourcemap-write: source file not found:/Users/luismartins/Sites/00_LAB/wp-multisite/wp-content/themes/wip053/src/sass/main.css
Should I be running autoprefixer as a separate task after CSS compilation?
Thanks.
Issue Analytics
- State:
- Created 9 years ago
- Comments:53 (1 by maintainers)
Top Results From Across the Web
gulp-sass - npm
Start using gulp-sass in your project by running `npm i gulp-sass`. There are 2411 other projects in the npm registry using gulp-sass.
Read more >Using Gulp and UnCSS in Combination with Sass based ...
Today I'll show you how we can use a Gulp build process to establish a convenient way to work on Hugo themes. Furthermore,...
Read more >Combining SCSS and SASS syntax with Gulp? - Stack Overflow
The plus + and parentheses () allows Gulp to match multiple patterns, with different patterns separated by the pipe | character. In this...
Read more >compiling Sass to CSS with gulp-sass plugin - ZetCode
The gulp-sass is a Gulp plugin for compiling Sass to CSS. Internally it uses the node-sass module. Installing Gulp and gulp-sass. We initiate...
Read more >Sass to CSS > Gulp! Refreshment for Your Frontend Assets
The problem is that it's not a CSS file at all - it's a Sass file that lives in app/Resources/assets . Btw, this...
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 Free
Top 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
I’ve had all the various sourcemap problems reported when trying to use gulp-sass, gulp-sourcemap and gulp-autoprefixer. After fiddling around for ages this is the final task template that works for me:
The things that made it work for me are wrapping
sourcemaps
calls around the sass and autoprefixer separately, passing the maps from the first into the second (withloadMaps
) and theincludeContent
andsourceRoot
options passed into thesourcemaps.write()
methods.Because the source maps don’t include the original content I’m allowing my dev server access to the original .scss files too, so that from the Chrome dev console I can click on the scss file name and view the original source directly. The dev console actually feels a little snappier this way too with large stylesheets.
The line numbering to the original file is slightly out due to autoprefixer adding the additional prefixed lines, but the important thing is that very quickly and with low friction I can find the style settings in the original .scss file.
@justnorris. Looks like @ahdinosaur’s solution was working all along. You will have to upgrade to gulp-sass 2.x branch, however:
npm install dlmanning/gulp-sass#2.x
(and make sure to update to the most recent node-sass as well).Here’s the bare-bones implementation:
Note: this is only for inline maps, I don’t think I’ve successfully got external maps to work.