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