Created
June 30, 2014 15:13
-
-
Save fubhy/e9b486f160fc6743267e to your computer and use it in GitHub Desktop.
Compass and LibSass
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
# Convert .scss to .css (including live reload). In some cases (e.g. when using | |
# Compass) the 'images' task has to run before this one so that utility | |
# functions like 'image-url' don't cause errors when evaluated before the image | |
# has been created. | |
gulp.task 'styles', ['images'], -> | |
sassConfig = | |
outputStyle: if isProduction then 'compressed' else 'expanded' | |
# Source maps are currently broken in 'gulp-sass'. | |
#sourceComments: 'map' | |
compassConfig = | |
sass: 'src/sass', | |
css: 'dist/css', | |
image: 'dist/images', | |
bundle_exec: true, | |
require: ['toolkit', 'singularitygs'] | |
# Compile the .scss and catch (and log) any potential errors so the pipe does | |
# not break. | |
sassStream = gulp.src(paths.sass) | |
.pipe(sass sassConfig) | |
.on('error', util.log) | |
.on('error', util.beep) | |
if useCompass | |
compassStream = gulp.src(paths.compass) | |
.pipe(compass compassConfig) | |
.on('error', util.log) | |
.on('error', util.beep) | |
sassStream = merge(sassStream, compassStream) | |
# Automatically add vendor prefixes. | |
sassStream.pipe(prefix ['last 2 version', '> 1%'], map: false) | |
# Write the compiled .css files and reload. | |
sassStream.pipe(gulp.dest 'dist/css') | |
.pipe(livereload server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment