Created
June 11, 2015 17:04
-
-
Save bonitron/b5c999a547184e29553e to your computer and use it in GitHub Desktop.
Sass gruntfile
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
module.exports = function(grunt) { | |
// Do grunt-related things in here | |
// Time how long tasks take. Can help when optimizing build times | |
require('time-grunt')(grunt); | |
// Load grunt tasks automatically | |
require('load-grunt-tasks')(grunt); | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
// Tasks | |
// Compiles Sass to CSS and generates necessary files if requested | |
sass: { | |
options: { | |
sourceMap: true, | |
}, | |
dist: { | |
files: [{ | |
expand: true, | |
// cwd: '.styles', | |
cwd: 'css/', | |
src: ['*.{scss,sass}'], | |
dest: '.tmp/css', | |
ext: '.css' | |
}] | |
} | |
}, | |
// Add vendor prefixed styles | |
autoprefixer: { | |
options: { | |
browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1', 'iOS > 7', 'ie 8', 'Safari > 6'] | |
}, | |
dist: { | |
files: [{ | |
expand: true, | |
cwd: '.tmp/css/', | |
src: 'main.css', | |
dest: 'css/' | |
}] | |
} | |
}, | |
cssmin: { | |
options: { | |
banner: '/* <%= pkg.name %> */' | |
}, | |
dist: { | |
files: { | |
'css/style.css': ['css/main.css'] | |
} | |
} | |
}, | |
watch: { | |
styles: { | |
files: ['css/main.scss', 'sass/*.scss'], | |
tasks: ['sass', 'autoprefixer', 'cssmin'], | |
options: { | |
spawn: false, | |
}, | |
}, | |
} | |
}); | |
// Default task(s). | |
grunt.registerTask('default', ['sass', 'autoprefixer', 'cssmin']); | |
}; |
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
{ | |
"name": "SassDependencies", | |
"version": "0.0.1", | |
"devDependencies": { | |
"grunt": "^0.4.5", | |
"grunt-autoprefixer": "^2.0.0", | |
"grunt-contrib-cssmin": "^0.10.0", | |
"grunt-contrib-nodeunit": "^0.4.1", | |
"grunt-contrib-watch": "^0.6.1", | |
"grunt-sass": "^0.17.0", | |
"load-grunt-tasks": "^1.0.0", | |
"time-grunt": "^1.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment