1
mirror of https://github.com/pure-css/pure synced 2024-11-26 08:27:21 +01:00
pure/Gruntfile.js

258 lines
6.7 KiB
JavaScript
Raw Normal View History

var path = require('path');
2013-05-09 23:56:32 +02:00
module.exports = function (grunt) {
// -- Config -------------------------------------------------------------------
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
bower: grunt.file.readJSON('bower.json'),
2013-05-09 23:56:32 +02:00
// -- Clean Config ---------------------------------------------------------
clean: {
build : ['build/'],
build_res: ['build/*-r.css'],
release : ['release/<%= pkg.version %>/']
},
// -- Copy Config ----------------------------------------------------------
2013-05-09 23:56:32 +02:00
copy: {
build: {
src : 'src/**/css/*.css',
dest : 'build/',
expand : true,
flatten: true
2014-02-05 18:52:39 +01:00
},
release: {
src : '{LICENSE.md,README.md,HISTORY.md}',
dest : 'build/'
}
},
2013-05-09 23:56:32 +02:00
// -- Concat Config --------------------------------------------------------
concat: {
build: {
files: [
{'build/base.css': [
'bower_components/normalize-css/normalize.css',
'build/base.css'
]},
{'build/buttons.css': [
'build/buttons-core.css',
'build/buttons.css'
]},
{'build/forms-nr.css': [
'build/forms.css'
]},
{'build/forms.css': [
'build/forms-nr.css',
'build/forms-r.css'
]},
{'build/grids-nr.css': [
'build/grids-core.css',
'build/grids-units.css'
]},
{'build/grids.css': [
'build/grids-nr.css',
'build/grids-r.css'
]},
{'build/menus-nr.css': [
'build/menus-core.css',
'build/menus.css',
'build/menus-paginator.css'
]},
{'build/menus.css': [
'build/menus-nr.css',
'build/menus-r.css'
]},
2013-05-09 23:56:32 +02:00
// Rollups
{'build/<%= pkg.name %>.css': [
'build/base.css',
'build/grids.css',
'build/buttons.css',
'build/forms.css',
'build/menus.css',
'build/tables.css'
]},
{'build/<%= pkg.name %>-nr.css': [
'build/base.css',
'build/grids-nr.css',
'build/buttons.css',
'build/forms-nr.css',
'build/menus-nr.css',
'build/tables.css'
]}
]
}
},
2013-05-09 23:56:32 +02:00
// -- CSSLint Config -------------------------------------------------------
csslint: {
options: {
csslintrc: '.csslintrc'
},
base : ['src/base/css/*.css'],
buttons: ['src/buttons/css/*.css'],
forms : ['src/forms/css/*.css'],
grids : ['src/grids/css/*.css'],
menus : ['src/menus/css/*.css'],
tables : ['src/tables/css/*.css']
},
// -- CSSMin Config --------------------------------------------------------
cssmin: {
options: {
// report: 'gzip'
2013-05-09 23:56:32 +02:00
},
files: {
expand: true,
src : 'build/*.css',
ext : '-min.css'
}
},
// -- Compress Config ------------------------------------------------------
compress: {
release: {
options: {
archive: 'release/<%= pkg.version %>/<%= pkg.name %>-<%= pkg.version %>.zip'
},
expand : true,
flatten: true,
2014-02-05 18:52:39 +01:00
src : 'build/*',
dest : '<%= pkg.name %>/<%= pkg.version %>/'
}
},
// -- License Config -------------------------------------------------------
license: {
normalize: {
options: {
banner: [
'/*!',
'normalize.css v<%= bower.devDependencies["normalize-css"] %> | MIT License | git.io/normalize',
'Copyright (c) Nicolas Gallagher and Jonathan Neal',
'*/\n'
].join('\n')
},
expand: true,
cwd : 'build/',
src : ['base*.css', '<%= pkg.name %>*.css']
},
yahoo: {
options: {
banner: [
'/*!',
'Pure v<%= pkg.version %>',
'Copyright 2013 Yahoo! Inc. All rights reserved.',
'Licensed under the BSD License.',
2013-05-16 19:01:32 +02:00
'https://github.com/yui/pure/blob/master/LICENSE.md',
'*/\n'
].join('\n')
},
expand: true,
src : ['build/*.css']
}
},
2013-11-18 20:46:19 +01:00
// -- Grid Units Config ----------------------------------------------------
grid_units: {
dest : 'build/grids-units.css',
units: [5, 24]
2013-11-18 20:46:19 +01:00
},
// -- CSS Selectors Config -------------------------------------------------
css_selectors: {
base: {
src : 'build/base.css',
dest: 'build/base-context.css',
options: {
mutations: [{prefix: '.pure'}]
2013-05-09 23:56:32 +02:00
}
}
2013-06-06 00:51:10 +02:00
},
// -- Watch/Observe Config -------------------------------------------------
2013-06-06 00:51:10 +02:00
observe: {
2013-06-06 00:51:10 +02:00
src: {
files: 'src/**/css/*.css',
tasks: ['test', 'suppress', 'build'],
2013-06-06 00:51:10 +02:00
options: {
interrupt: true
}
}
2013-05-09 23:56:32 +02:00
}
});
// -- Main Tasks ---------------------------------------------------------------
2013-11-18 20:45:37 +01:00
// npm tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-csslint');
2013-05-09 23:56:32 +02:00
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-compress');
2013-06-06 00:51:10 +02:00
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-css-selectors');
2013-05-09 23:56:32 +02:00
2013-11-18 20:45:37 +01:00
// Local tasks.
grunt.loadTasks('tasks/');
grunt.registerTask('default', ['import', 'test', 'build']);
2013-11-18 20:45:37 +01:00
grunt.registerTask('import', ['bower_install']);
grunt.registerTask('test', ['csslint']);
grunt.registerTask('build', [
'clean:build',
'copy:build',
2013-11-18 20:46:19 +01:00
'grid_units',
'concat:build',
'clean:build_res',
'css_selectors:base',
'cssmin',
'license'
]);
// Makes the `watch` task run a build first.
grunt.renameTask('watch', 'observe');
grunt.registerTask('watch', ['default', 'observe']);
grunt.registerTask('release', [
'default',
'clean:release',
2014-02-05 18:52:39 +01:00
'copy:release',
'bower_json',
'compress:release'
]);
2013-05-09 23:56:32 +02:00
};