Autoprefixer Breaks CSS Source Maps
See original GitHub issueHere’s my gruntfile.js:
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('load-grunt-tasks')(grunt);
grunt.initConfig({
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'user/themes/br/css-compiled/bobmess.css': 'user/themes/br/scss/bobmess.scss'
}
}
},
autoprefixer: {
dist: {
src: 'user/themes/br/css-compiled/bobmess.css'
}
},
watch: {
scss: {
files: ['user/themes/br/scss/*.scss'],
tasks: ['sass', 'autoprefixer'],
},
livereload: {
files: ['user/**/*.{css,md,twig,js,yaml}'],
options: {
livereload: true
}
}
}
});
grunt.registerTask('default', ['watch']);
};
Running it creates a css file and a source map with LibSass via grunt-sass. But Chrome does not recognize the source map. If I comment out the autoprefixer task, the source map is recognized by Chrome. I’ve tried it with grunt-contrib-sass (which uses Ruby Sass) and I find the same behavior.
It seems as if autoprefixer is messing up the source map, or the reference to it, somehow.
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
autoprefixer breaks trying to parse node-sass sourcemap
I'm trying to rewrite my workflow using NPM scripts. I want to: convert all .scss files > css > autoprefix > minify >...
Read more >postcss - npm
The Autoprefixer PostCSS plugin is one of the most popular CSS processors. ... const sourcemaps = require('gulp-sourcemaps').
Read more >Advanced Features: Customizing PostCSS Config - Next.js
Extend the PostCSS config and plugins added by Next.js with your own. ... Source Maps · Codemods · Internationalized Routing · Output File...
Read more >PostCSS API
Simple CSS concatenation with source map support const root1 = postcss.parse(css1, { from: file1 }) ... Returning false in the callback will break...
Read more >Solution to no CSS source map file generated under ...
The issue is in Webpack 4 under "production" mode there is no source map file generated only for CSS (no problem in javascript...
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 eventually got it working with:
Explicitly turning on source maps for autoprefixer was the trick for me.
This issue is not limited to grunt. For example: sindresorhus/gulp-autoprefixer#1, floridoo/gulp-sourcemaps#60, dlmanning/gulp-sass#106, appleboy/gulp-compass#92
We can produce a bogus sourcemap by adding gulp-sass to the current gulp example.
One work-around has been to roll back gulp-sass to ~1.2.4 and to re-initialize sourcemaps before Autoprefixer is run.