Skip to content

Instantly share code, notes, and snippets.

@pryley
Created Jan 2, 2015
Embed
What would you like to do?
module.exports = function( grunt )
{
'use strict';
grunt.initConfig( {
clean: {
dist: [
'public/assets/css/*',
]
},
compass: {
dist: {
options: {
sourcemap: true,
config : 'config.rb'
}
}
},
grunticon: {
svg: {
files: [{
expand: true,
cwd : 'app/assets/svg/min',
src : [ '*.svg' ],
dest : "public/assets/css"
}
],
options: {
datasvgcss: 'svg.css',
datapngcss: 'png.css',
urlpngcss : 'fallback.css',
pngfolder : 'public/assets/img/fallback',
cssprefix : '.svg-'
}
}
},
postcss: {
options: {
map: false,
processors: [
require( 'csswring' )( { removeAllComments: true } ).postcss
]
},
dist: {
src: 'public/assets/css/*.css'
}
},
svgmin: {
options: {
plugins: [
{ removeViewBox: false },
{ removeUselessStrokeAndFill: false }
]
},
dist: {
files: [
{
expand: true,
cwd : 'app/assets/svg',
src : [ '*.svg' ],
dest : 'app/assets/svg/min',
ext : '.svg'
}
]
}
},
watch: {
options: {
livereload: true
},
css: {
files: [
'app/assets/scss/**/*.scss'
],
tasks: [
'compass',
'postcss'
]
},
svg: {
files: [
'app/assets/svg/*.svg'
],
tasks: [
'svgmin',
'grunticon:svg',
'compass',
'postcss'
]
}
}
} );
// Load tasks
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-contrib-compass' );
grunt.loadNpmTasks( 'grunt-contrib-concat' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-grunticon' );
grunt.loadNpmTasks( 'grunt-postcss' );
grunt.loadNpmTasks( 'grunt-svgmin' );
// Register tasks
grunt.registerTask( 'default', [
'clean',
'svgmin',
'grunticon:svg',
'compass',
'postcss',
] );
grunt.registerTask( 'dev', [
'watch'
] );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment