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