Skip to content

Instantly share code, notes, and snippets.

@iambacon
Last active August 29, 2015 14:05
Show Gist options
  • Save iambacon/9c24e5b5050ae5573d66 to your computer and use it in GitHub Desktop.
Save iambacon/9c24e5b5050ae5573d66 to your computer and use it in GitHub Desktop.
Compiling SASS with libsass, Autoprefixer and grunt
module.exports = function (grunt) {
'use strict';
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Sass
sass: {
options: {
sourceMap: true, // Create source map
outputStyle: 'compressed' // minify output
},
dist: {
files: [
{
expand: true, // Recursive
cwd: "sass/brand", // The startup directory
src: ["**/*.scss"], // Source files
dest: "stylesheets", // Destination
ext: ".css" // File extension
}
]
}
},
// Autoprefixer
autoprefixer: {
options: {
browsers: [
'Android 4',
'last 2 Chrome version',
'last 2 iOS version',
'last 2 Safari version',
'last 2 ChromeAndroid version',
'last 2 FirefoxAndroid version',
'last 2 ExplorerMobile version'
],
map: true // Update source map (creates one if it can't find an existing map)
},
// Prefix all files
multiple_files: {
flatten: true,
src: 'stylesheets/**/*.css'
},
}
});
grunt.registerTask('default', ['sass', 'autoprefixer']);
};
{
"name": "MoSite",
"version": "0.0.1",
"devDependencies": {
"grunt": "0.4.5",
"grunt-sass": "^0.12.1",
"grunt-autoprefixer": "1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment