Skip to content
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

Sourcemaps with autoprefixer on windows #296

Closed
JosephSilber opened this issue Jun 12, 2015 · 5 comments
Closed

Sourcemaps with autoprefixer on windows #296

JosephSilber opened this issue Jun 12, 2015 · 5 comments

Comments

@JosephSilber
Copy link

When trying to get sourcemaps for sass + autoprefixer on Windows, the resulting sourcemap's contentSource is the compiled CSS, not the original sass.

var autoprefixer = require('gulp-autoprefixer');
var gulp = require('gulp');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('css', function () {
    gulp.src('resources/assets/sass/app.scss')
        .pipe(sourcemaps.init())
        .pipe(sass({ outputStyle: 'compressed' }))
        .pipe(autoprefixer())
        .pipe(rename('css/app.css'))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('public'));
});

Running autoprefixer without sass results in proper sourcemaps.


For more context, see here: http://stackoverflow.com/questions/30805146


To test this on a Windows machine, download this: gulp-sass-autoprefixer-sourcemaps.zip.

Unzip, and run: npm install && gulp css.

@lagunovsky
Copy link

var myth = require('gulp-myth');
var gulp = require('gulp');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var csso = require('gulp-csso');
var sourcemaps = require('gulp-sourcemaps');

gulp.task('css', function () {
    gulp.src('resources/assets/sass/app.scss')
        .pipe(sourcemaps.init())
        .pipe(sass({errLogToConsole: true}))
        .pipe(myth())
        .pipe(csso())
        .pipe(rename('css/app.css'))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('public'));
});

Upd. myth does not implement the full version of autoprefixer.

@Snugug
Copy link
Collaborator

Snugug commented Jun 24, 2015

What version of Gulp Sass are you using? Does it happen if you reduce your pipe to just Sass and Sourcemaps?

@MaciejJanyska
Copy link

I'm using the newest version of gulp-sass and have the same issue on Windows 7. When autoprefixer is used, "sources" is my compiled css. Without it, everything is fine and sources include sass files.

style.css.map (with autoprefixer):

{"version":3,"sources":["style.css"],"names":[] (...)

style.css.map (without autoprefixer):

{"version":3,"sources":["_settings.scss","libs/bootstrap/_normalize.scss","libs/bootstrap/_print.scss", (...)

@TrySound
Copy link
Contributor

@ALL #314

@Snugug
Copy link
Collaborator

Snugug commented Jul 14, 2015

Resolved by #314

@Snugug Snugug closed this as completed Jul 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants