mirror of
https://github.com/pure-css/pure
synced 2024-12-25 05:23:43 +01:00
370d0d3218
Closes #366
297 lines
7.8 KiB
JavaScript
297 lines
7.8 KiB
JavaScript
module.exports = function (grunt) {
|
|
|
|
// -- Config -------------------------------------------------------------------
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg : grunt.file.readJSON('package.json'),
|
|
bower: grunt.file.readJSON('bower.json'),
|
|
|
|
// -- bower.json Config ---------------------------------------------------------
|
|
|
|
bower_json: {
|
|
release: {
|
|
values: {
|
|
main: 'pure.css'
|
|
},
|
|
|
|
dest: 'build/'
|
|
}
|
|
},
|
|
|
|
// -- Clean Config ---------------------------------------------------------
|
|
|
|
clean: {
|
|
build : ['build/'],
|
|
build_res: ['build/*-r.css'],
|
|
release : ['release/<%= pkg.version %>/']
|
|
},
|
|
|
|
// -- Copy Config ----------------------------------------------------------
|
|
|
|
copy: {
|
|
build: {
|
|
src : 'src/**/css/*.css',
|
|
dest : 'build/',
|
|
expand : true,
|
|
flatten: true
|
|
},
|
|
|
|
release: {
|
|
src : '{LICENSE.md,README.md,HISTORY.md}',
|
|
dest: 'build/'
|
|
}
|
|
},
|
|
|
|
// -- 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.css': [
|
|
'build/grids-core.css',
|
|
'build/grids-units.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'
|
|
]},
|
|
|
|
// 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.css',
|
|
'build/buttons.css',
|
|
'build/forms-nr.css',
|
|
'build/menus-nr.css',
|
|
'build/tables.css'
|
|
]}
|
|
]
|
|
}
|
|
},
|
|
|
|
// -- 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: {
|
|
noAdvanced: true
|
|
},
|
|
|
|
files: {
|
|
expand: true,
|
|
src : 'build/*.css',
|
|
ext : '-min.css'
|
|
}
|
|
},
|
|
|
|
// -- Compress Config ------------------------------------------------------
|
|
|
|
compress: {
|
|
release: {
|
|
options: {
|
|
archive: 'release/<%= pkg.version %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz'
|
|
},
|
|
|
|
expand : true,
|
|
flatten: true,
|
|
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 2014 Yahoo! Inc. All rights reserved.',
|
|
'Licensed under the BSD License.',
|
|
'https://github.com/yahoo/pure/blob/master/LICENSE.md',
|
|
'*/\n'
|
|
].join('\n')
|
|
},
|
|
|
|
expand: true,
|
|
src : ['build/*.css']
|
|
}
|
|
},
|
|
|
|
// -- Pure Grids Units Config ----------------------------------------------
|
|
|
|
pure_grids: {
|
|
default_units: {
|
|
dest: 'build/grids-units.css',
|
|
|
|
options: {
|
|
units: [5, 24]
|
|
}
|
|
},
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
// -- Strip Media Queries Config -------------------------------------------
|
|
|
|
stripmq: {
|
|
all: {
|
|
files: {
|
|
//follows the pattern 'destination': ['source']
|
|
'build/grids-responsive-old-ie.css':
|
|
['build/grids-responsive.css']
|
|
}
|
|
}
|
|
},
|
|
|
|
// -- CSS Selectors Config -------------------------------------------------
|
|
|
|
css_selectors: {
|
|
base: {
|
|
src : 'build/base.css',
|
|
dest: 'build/base-context.css',
|
|
|
|
options: {
|
|
mutations: [{prefix: '.pure'}]
|
|
}
|
|
}
|
|
},
|
|
|
|
// -- Watch/Observe Config -------------------------------------------------
|
|
|
|
observe: {
|
|
src: {
|
|
files: 'src/**/css/*.css',
|
|
tasks: ['test', 'suppress', 'build'],
|
|
|
|
options: {
|
|
interrupt: true
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// -- Main Tasks ---------------------------------------------------------------
|
|
|
|
// npm tasks.
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
grunt.loadNpmTasks('grunt-contrib-csslint');
|
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
|
grunt.loadNpmTasks('grunt-contrib-compress');
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
grunt.loadNpmTasks('grunt-css-selectors');
|
|
grunt.loadNpmTasks('grunt-pure-grids');
|
|
grunt.loadNpmTasks('grunt-stripmq');
|
|
|
|
// Local tasks.
|
|
grunt.loadTasks('tasks/');
|
|
|
|
grunt.registerTask('default', ['import', 'test', 'build']);
|
|
grunt.registerTask('import', ['bower_install']);
|
|
grunt.registerTask('test', ['csslint']);
|
|
grunt.registerTask('build', [
|
|
'clean:build',
|
|
'copy:build',
|
|
'pure_grids',
|
|
'stripmq',
|
|
'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',
|
|
'copy:release',
|
|
'bower_json:release',
|
|
'compress:release'
|
|
]);
|
|
|
|
};
|