2013-05-09 21:56:32 +00:00
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
|
|
|
// -- Config -------------------------------------------------------------------
|
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
|
2015-03-05 18:25:10 +00:00
|
|
|
nick : 'pure',
|
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
|
|
|
|
2014-02-06 22:44:02 +00:00
|
|
|
// -- bower.json Config ---------------------------------------------------------
|
2013-05-09 21:56:32 +00:00
|
|
|
|
2014-02-06 22:44:02 +00:00
|
|
|
bower_json: {
|
|
|
|
release: {
|
2014-02-07 08:43:40 +00:00
|
|
|
values: {
|
|
|
|
main: 'pure.css'
|
|
|
|
},
|
|
|
|
|
|
|
|
dest: 'build/'
|
2014-02-06 22:44:02 +00:00
|
|
|
}
|
|
|
|
},
|
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: {
|
|
|
|
src : 'src/**/css/*.css',
|
|
|
|
dest : 'build/',
|
|
|
|
expand : true,
|
2013-11-27 19:40:20 +00:00
|
|
|
flatten: true
|
2014-02-05 17:52:39 +00:00
|
|
|
},
|
2013-05-14 17:12:01 +00:00
|
|
|
|
2014-02-05 17:52:39 +00:00
|
|
|
release: {
|
2014-02-07 08:43:40 +00:00
|
|
|
src : '{LICENSE.md,README.md,HISTORY.md}',
|
|
|
|
dest: 'build/'
|
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'
|
|
|
|
]},
|
|
|
|
|
2014-02-28 18:13:10 +00:00
|
|
|
{'build/grids.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/menus.css': [
|
2015-01-29 23:23:21 +00:00
|
|
|
'build/menus-core.css',
|
|
|
|
'build/menus-horizontal.css',
|
|
|
|
'build/menus-dropdown.css',
|
|
|
|
'build/menus-scrollable.css',
|
|
|
|
'build/menus-skin.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
|
|
|
|
|
2015-03-05 18:25:10 +00:00
|
|
|
{'build/<%= nick %>.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
|
|
|
]},
|
|
|
|
|
2015-03-05 18:25:10 +00:00
|
|
|
{'build/<%= nick %>-nr.css': [
|
2013-08-27 16:34:16 +00:00
|
|
|
'build/base.css',
|
2014-02-28 18:13:10 +00:00
|
|
|
'build/grids.css',
|
2013-08-27 16:34:16 +00:00
|
|
|
'build/buttons.css',
|
|
|
|
'build/forms-nr.css',
|
2015-01-29 23:23:21 +00:00
|
|
|
'build/menus.css',
|
2013-08-27 16:34:16 +00:00
|
|
|
'build/tables.css'
|
2013-05-14 17:12:01 +00:00
|
|
|
]}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2013-05-09 21:56:32 +00:00
|
|
|
|
2016-02-08 23:11:54 +00:00
|
|
|
// -- PostCSS Config --------------------------------------------------------
|
|
|
|
|
|
|
|
postcss: {
|
|
|
|
options: {
|
|
|
|
processors: [
|
|
|
|
require('autoprefixer')({browsers: ['last 2 versions', 'ie >= 8', 'iOS >= 6', 'Android >= 4']})
|
|
|
|
]
|
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
src: 'build/*.css'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
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: {
|
2014-02-06 22:22:17 +00:00
|
|
|
noAdvanced: true
|
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: {
|
2015-03-05 18:25:10 +00:00
|
|
|
archive: 'release/<%= pkg.version %>/<%= nick %>-<%= pkg.version %>.tar.gz'
|
2013-05-14 19:58:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
expand : true,
|
|
|
|
flatten: true,
|
2014-02-05 17:52:39 +00:00
|
|
|
src : 'build/*',
|
2015-03-05 18:25:10 +00:00
|
|
|
dest : '<%= nick %>/<%= pkg.version %>/'
|
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/',
|
2015-03-05 18:25:10 +00:00
|
|
|
src : ['base*.css', '<%= nick %>*.css']
|
2013-05-14 20:59:18 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
yahoo: {
|
|
|
|
options: {
|
|
|
|
banner: [
|
|
|
|
'/*!',
|
2013-05-23 13:44:48 +00:00
|
|
|
'Pure v<%= pkg.version %>',
|
2016-11-10 20:40:04 +00:00
|
|
|
'Copyright 2013 Yahoo!',
|
2013-05-14 20:59:18 +00:00
|
|
|
'Licensed under the BSD License.',
|
2018-01-19 03:41:39 +00:00
|
|
|
'https://github.com/pure-css/pure/blob/master/LICENSE.md',
|
2013-05-14 20:59:18 +00:00
|
|
|
'*/\n'
|
|
|
|
].join('\n')
|
|
|
|
},
|
|
|
|
|
|
|
|
expand: true,
|
|
|
|
src : ['build/*.css']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-02-18 16:55:22 +00:00
|
|
|
// -- Pure Grids Units Config ----------------------------------------------
|
2013-05-14 17:12:01 +00:00
|
|
|
|
2014-02-18 16:55:22 +00:00
|
|
|
pure_grids: {
|
|
|
|
default_units: {
|
|
|
|
dest: 'build/grids-units.css',
|
2013-05-14 17:12:01 +00:00
|
|
|
|
|
|
|
options: {
|
2014-02-18 16:55:22 +00:00
|
|
|
units: [5, 24]
|
|
|
|
}
|
2014-02-28 17:56:50 +00: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 16:55:22 +00:00
|
|
|
}
|
2013-11-18 19:46:19 +00:00
|
|
|
},
|
|
|
|
|
2014-03-07 18:15:06 +00: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 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');
|
2016-02-08 23:11:54 +00:00
|
|
|
grunt.loadNpmTasks('grunt-postcss');
|
2014-02-18 16:55:22 +00:00
|
|
|
grunt.loadNpmTasks('grunt-pure-grids');
|
2014-03-07 18:15:06 +00:00
|
|
|
grunt.loadNpmTasks('grunt-stripmq');
|
2013-05-09 21:56:32 +00:00
|
|
|
|
2013-11-18 19:45:37 +00:00
|
|
|
// Local tasks.
|
|
|
|
grunt.loadTasks('tasks/');
|
2013-05-09 21:56:32 +00:00
|
|
|
|
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',
|
2014-02-18 16:55:22 +00:00
|
|
|
'pure_grids',
|
2014-03-07 18:15:06 +00:00
|
|
|
'stripmq',
|
2013-05-14 17:12:01 +00:00
|
|
|
'concat:build',
|
|
|
|
'clean:build_res',
|
2013-11-27 19:40:20 +00:00
|
|
|
'css_selectors:base',
|
2016-02-08 23:11:54 +00:00
|
|
|
'postcss',
|
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',
|
2014-02-05 17:52:39 +00:00
|
|
|
'copy:release',
|
2014-02-07 08:43:40 +00:00
|
|
|
'bower_json:release',
|
2013-05-14 19:58:25 +00:00
|
|
|
'compress:release'
|
|
|
|
]);
|
|
|
|
|
2013-05-09 21:56:32 +00:00
|
|
|
};
|