milligram/gruntfile.js

151 lines
2.8 KiB
JavaScript
Raw Normal View History

2015-12-26 01:51:02 +00:00
module.exports = function ( grunt ) {
'use strict';
// ================================================================
// CONFIG TASKS
// ================================================================
// Define the configuration
grunt.initConfig({
// Specifics of npm's package.json handling
pkg: grunt.file.readJSON( 'package.json' ),
2015-12-26 21:38:44 +00:00
// Banner
banner:
'/*!\n'+
' * Milligram v<%= pkg.version %>\n'+
' * <%= pkg.homepage %>\n'+
' *\n'+
2016-01-06 07:15:54 +00:00
' * Copyright (c) '+new Date().getFullYear()+' CJ Patoilo\n'+
2015-12-26 21:38:44 +00:00
' * Licensed under the <%= pkg.license %> license\n'+
'*/\n\n',
// DEFAULT TASK
// ================================================================
2015-12-26 01:51:02 +00:00
// Watch files and process the above tasks
watch: {
options: {
livereload: false
},
grunt: {
files: [
'gruntfile.js'
],
options: {
reload: true
}
},
sass: {
files: [
2015-12-26 21:38:44 +00:00
'src/**/*.sass'
2015-12-26 01:51:02 +00:00
],
tasks: [
'sass',
'autoprefixer'
]
}
},
// BUILD TASKS
// ================================================================
// Clear files and folders
clean: {
all: [ 'dist' ]
},
// Compile Sass files to CSS
2015-12-26 01:51:02 +00:00
sass: {
minify: {
options: {
2015-12-26 21:38:44 +00:00
banner: '<%= banner %>',
2015-12-26 01:51:02 +00:00
noCache: true,
sourcemap: 'none',
style: 'compressed'
},
files: {
2015-12-26 21:38:44 +00:00
'dist/milligram.min.css': [ 'src/**/*.sass', '!src/**/_*.sass' ]
2015-12-26 01:51:02 +00:00
}
},
default: {
options: {
2015-12-26 21:38:44 +00:00
banner: '<%= banner %>',
2015-12-26 01:51:02 +00:00
noCache: true,
sourcemap: 'none',
style: 'expanded'
},
files: {
2015-12-26 21:38:44 +00:00
'dist/milligram.css': [ 'src/**/*.sass', '!src/**/_*.sass' ]
2015-12-26 01:51:02 +00:00
}
}
},
// Parse CSS and add vendor-prefixed CSS properties using the Can I Use database.
autoprefixer: {
2015-12-26 21:38:44 +00:00
minify: {
options: {
browsers: [
'last 1 versions'
],
map: {
inline: false
}
},
files: {
'dist/milligram.min.css': 'dist/milligram.min.css'
}
},
default: {
2015-12-26 01:51:02 +00:00
options: {
browsers: [
2015-12-26 21:38:44 +00:00
'last 1 versions'
2015-12-26 01:51:02 +00:00
],
map: false
},
files: {
'dist/milligram.css': 'dist/milligram.css'
}
}
}
});
// ================================================================
// REGISTER TASKS
// ================================================================
2015-12-26 21:38:44 +00:00
// Default task
2015-12-26 01:51:02 +00:00
grunt.registerTask( 'default', [
'build',
'watch'
]);
2015-12-26 21:38:44 +00:00
// Build task
2015-12-26 01:51:02 +00:00
grunt.registerTask( 'build', [
'clean',
'sass',
'autoprefixer'
]);
// ================================================================
// LOAD TASKS
// ================================================================
// Automatically loading Grunt tasks
require( 'load-grunt-tasks' )( grunt );
// Display the elapsed execution time of Grunt tasks
require( 'time-grunt' )( grunt );
};
// Code is Poetry