2013-05-09 23:56:32 +02:00
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
|
|
|
// -- Config -------------------------------------------------------------------
|
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
|
2015-03-05 19:25:10 +01:00
|
|
|
nick : 'pure',
|
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
|
|
|
|
2014-02-06 23:44:02 +01:00
|
|
|
// -- bower.json Config ---------------------------------------------------------
|
2013-05-09 23:56:32 +02:00
|
|
|
|
2014-02-06 23:44:02 +01:00
|
|
|
bower_json: {
|
|
|
|
release: {
|
2014-02-07 09:43:40 +01:00
|
|
|
values: {
|
|
|
|
main: 'pure.css'
|
|
|
|
},
|
|
|
|
|
|
|
|
dest: 'build/'
|
2014-02-06 23:44:02 +01:00
|
|
|
}
|
|
|
|
},
|
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: {
|
|
|
|
src : 'src/**/css/*.css',
|
|
|
|
dest : 'build/',
|
|
|
|
expand : true,
|
2013-11-27 20:40:20 +01:00
|
|
|
flatten: true
|
2014-02-05 18:52:39 +01:00
|
|
|
},
|
2013-05-14 19:12:01 +02:00
|
|
|
|
2014-02-05 18:52:39 +01:00
|
|
|
release: {
|
2014-02-07 09:43:40 +01:00
|
|
|
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'
|
|
|
|
]},
|
|
|
|
|
2014-02-28 19:13:10 +01:00
|
|
|
{'build/grids.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/menus.css': [
|
2015-01-30 00:23:21 +01:00
|
|
|
'build/menus-core.css',
|
|
|
|
'build/menus-horizontal.css',
|
|
|
|
'build/menus-dropdown.css',
|
|
|
|
'build/menus-scrollable.css',
|
|
|
|
'build/menus-skin.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
|
|
|
|
|
2015-03-05 19:25:10 +01:00
|
|
|
{'build/<%= nick %>.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
|
|
|
]},
|
|
|
|
|
2015-03-05 19:25:10 +01:00
|
|
|
{'build/<%= nick %>-nr.css': [
|
2013-08-27 18:34:16 +02:00
|
|
|
'build/base.css',
|
2014-02-28 19:13:10 +01:00
|
|
|
'build/grids.css',
|
2013-08-27 18:34:16 +02:00
|
|
|
'build/buttons.css',
|
|
|
|
'build/forms-nr.css',
|
2015-01-30 00:23:21 +01:00
|
|
|
'build/menus.css',
|
2013-08-27 18:34:16 +02:00
|
|
|
'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: {
|
2014-02-06 23:22:17 +01:00
|
|
|
noAdvanced: true
|
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: {
|
2015-03-05 19:25:10 +01:00
|
|
|
archive: 'release/<%= pkg.version %>/<%= nick %>-<%= pkg.version %>.tar.gz'
|
2013-05-14 21:58:25 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
expand : true,
|
|
|
|
flatten: true,
|
2014-02-05 18:52:39 +01:00
|
|
|
src : 'build/*',
|
2015-03-05 19:25:10 +01:00
|
|
|
dest : '<%= nick %>/<%= 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/',
|
2015-03-05 19:25:10 +01:00
|
|
|
src : ['base*.css', '<%= nick %>*.css']
|
2013-05-14 22:59:18 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
yahoo: {
|
|
|
|
options: {
|
|
|
|
banner: [
|
|
|
|
'/*!',
|
2013-05-23 15:44:48 +02:00
|
|
|
'Pure v<%= pkg.version %>',
|
2016-11-10 21:40:04 +01:00
|
|
|
'Copyright 2013 Yahoo!',
|
2013-05-14 22:59:18 +02:00
|
|
|
'Licensed under the BSD License.',
|
2014-08-26 18:05:45 +02:00
|
|
|
'https://github.com/yahoo/pure/blob/master/LICENSE.md',
|
2013-05-14 22:59:18 +02:00
|
|
|
'*/\n'
|
|
|
|
].join('\n')
|
|
|
|
},
|
|
|
|
|
|
|
|
expand: true,
|
|
|
|
src : ['build/*.css']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-02-18 17:55:22 +01:00
|
|
|
// -- Pure Grids Units Config ----------------------------------------------
|
2013-05-14 19:12:01 +02:00
|
|
|
|
2014-02-18 17:55:22 +01:00
|
|
|
pure_grids: {
|
|
|
|
default_units: {
|
|
|
|
dest: 'build/grids-units.css',
|
2013-05-14 19:12:01 +02:00
|
|
|
|
|
|
|
options: {
|
2014-02-18 17:55:22 +01:00
|
|
|
units: [5, 24]
|
|
|
|
}
|
2014-02-28 18:56:50 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
responsive: {
|
|
|
|
dest: 'build/grids-responsive.css',
|
|
|
|
|
|
|
|
options: {
|
|
|
|
mediaQueries: {
|
|
|
|
sm: 'screen and (min-width: 35.5em)', // 568px
|
|
|
|
md: 'screen and (min-width: 48em)', // 768px
|
|
|
|
lg: 'screen and (min-width: 64em)', // 1024px
|
|
|
|
xl: 'screen and (min-width: 80em)' // 1280px
|
|
|
|
}
|
|
|
|
}
|
2014-02-18 17:55:22 +01:00
|
|
|
}
|
2013-11-18 20:46:19 +01:00
|
|
|
},
|
|
|
|
|
2014-03-07 19:15:06 +01:00
|
|
|
// -- Strip Media Queries Config -------------------------------------------
|
|
|
|
|
|
|
|
stripmq: {
|
|
|
|
all: {
|
|
|
|
files: {
|
|
|
|
//follows the pattern 'destination': ['source']
|
|
|
|
'build/grids-responsive-old-ie.css':
|
|
|
|
['build/grids-responsive.css']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
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');
|
2014-02-18 17:55:22 +01:00
|
|
|
grunt.loadNpmTasks('grunt-pure-grids');
|
2014-03-07 19:15:06 +01:00
|
|
|
grunt.loadNpmTasks('grunt-stripmq');
|
2013-05-09 23:56:32 +02:00
|
|
|
|
2013-11-18 20:45:37 +01:00
|
|
|
// Local tasks.
|
|
|
|
grunt.loadTasks('tasks/');
|
2013-05-09 23:56:32 +02:00
|
|
|
|
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',
|
2014-02-18 17:55:22 +01:00
|
|
|
'pure_grids',
|
2014-03-07 19:15:06 +01:00
|
|
|
'stripmq',
|
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',
|
2014-02-07 09:43:40 +01:00
|
|
|
'bower_json:release',
|
2013-05-14 21:58:25 +02:00
|
|
|
'compress:release'
|
|
|
|
]);
|
|
|
|
|
2013-05-09 23:56:32 +02:00
|
|
|
};
|