Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChase Nobles
Full Stack JavaScript Techdegree Student 13,633 PointsGulp Source Maps on Minified CSS
Trying to get a sourcemap to show on the minified all.min.css in chrome when I run gulp styles.
gulp.task("concatCSS", function(){
return gulp.src("sass/global.scss")
.pipe(maps.init())
.pipe(sass())
.pipe(maps.write('./'))
.pipe(gulp.dest('dest/styles'))
});
gulp.task('styles', ['concatCSS'], function(){
return gulp.src("dest/styles/global.css")
.pipe(maps.init())
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(rename("all.min.css"))
.pipe(maps.write('./'))
.pipe(gulp.dest('dest/styles'));
});```
Chase Nobles
Full Stack JavaScript Techdegree Student 13,633 PointsIt's mapping to the global.css file but not back to the individual sass files.
Tried mapping and minification in one place, but same thing. When I inspect an element on the page it references global.css which doesn't even exist in my files.
gulp.task('styles', function(){
return gulp.src("sass/global.scss")
.pipe(maps.init())
.pipe(sass())
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(rename("all.min.css"))
.pipe(maps.write('./'))
.pipe(gulp.dest('dest/styles'));
});
1 Answer
Adam Beer
11,314 PointsThis is my solution. This is the end of course.
gulp.task("minifyScripts",["concatScripts"], function() {
return gulp.src('js/app.js')
.pipe(uglify())
.pipe(rename('app.min.js'))
.pipe(gulp.dest('js'));
});
gulp.task('compileSass', function() {
return gulp.src("_sass/application.scss")
.pipe(maps.init())
.pipe(sass())
.pipe(maps.write('./'))
.pipe(gulp.dest('css'));
});
Chase Nobles
Full Stack JavaScript Techdegree Student 13,633 PointsI'm trying to minify the css and preserve the source maps. While you compiled the Sass files here, you didn't minify the final css and maintain the sourcemaps.
Adam Beer
11,314 PointsAdam Beer
11,314 PointsCode
Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.