2013-05-09 23:56:32 +02:00
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- Config -------------------------------------------------------------------
|
2013-05-09 23:56:32 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
grunt.initConfig({
|
2013-05-09 23:56:32 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
nick : 'pure',
|
|
|
|
pkg : grunt.file.readJSON('package.json'),
|
2013-05-09 23:56:32 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- Clean Config ---------------------------------------------------------
|
2013-05-13 20:56:23 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
clean: {
|
|
|
|
build : ['build/'],
|
|
|
|
build_res: ['build/*-r.css'],
|
|
|
|
release : ['release/<%= pkg.version %>/']
|
2014-02-05 18:52:39 +01:00
|
|
|
},
|
2013-05-14 19:12:01 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- Copy Config ----------------------------------------------------------
|
2013-05-09 23:56:32 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
copy: {
|
|
|
|
build: {
|
|
|
|
src : 'src/**/css/*.css',
|
|
|
|
dest : 'build/',
|
|
|
|
expand : true,
|
|
|
|
flatten: true
|
|
|
|
},
|
2016-02-09 00:11:54 +01:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
release: {
|
2020-10-18 14:14:38 +02:00
|
|
|
src : '{LICENSE,README.md,HISTORY.md}',
|
2020-05-16 20:09:14 +02:00
|
|
|
dest: 'build/'
|
|
|
|
}
|
2016-02-09 00:11:54 +01:00
|
|
|
},
|
2013-06-05 15:25:13 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- Concat Config --------------------------------------------------------
|
|
|
|
|
|
|
|
concat: {
|
|
|
|
build: {
|
|
|
|
files: [
|
|
|
|
{'build/base.css': [
|
|
|
|
'node_modules/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.css': [
|
|
|
|
'build/menus-core.css',
|
|
|
|
'build/menus-horizontal.css',
|
|
|
|
'build/menus-dropdown.css',
|
|
|
|
'build/menus-scrollable.css',
|
|
|
|
'build/menus-skin.css',
|
|
|
|
]},
|
|
|
|
|
|
|
|
// Rollups
|
|
|
|
|
|
|
|
{'build/<%= nick %>.css': [
|
|
|
|
'build/base.css',
|
|
|
|
'build/grids.css',
|
|
|
|
'build/buttons.css',
|
|
|
|
'build/forms.css',
|
|
|
|
'build/menus.css',
|
|
|
|
'build/tables.css'
|
|
|
|
]},
|
|
|
|
|
|
|
|
{'build/<%= nick %>-nr.css': [
|
|
|
|
'build/base.css',
|
|
|
|
'build/grids.css',
|
|
|
|
'build/buttons.css',
|
|
|
|
'build/forms-nr.css',
|
|
|
|
'build/menus.css',
|
|
|
|
'build/tables.css'
|
|
|
|
]}
|
|
|
|
]
|
|
|
|
}
|
2013-06-05 15:25:13 +02:00
|
|
|
},
|
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- PostCSS Config --------------------------------------------------------
|
2013-05-14 19:12:01 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
postcss: {
|
|
|
|
options: {
|
|
|
|
processors: [
|
|
|
|
require('autoprefixer')()
|
|
|
|
]
|
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
src: 'build/*.css'
|
|
|
|
}
|
2013-05-09 23:56:32 +02:00
|
|
|
},
|
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- CSSLint Config -------------------------------------------------------
|
2013-05-14 21:58:25 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
csslint: {
|
2013-05-14 21:58:25 +02:00
|
|
|
options: {
|
2020-05-16 20:09:14 +02:00
|
|
|
csslintrc: '.csslintrc'
|
2013-05-14 21:58:25 +02:00
|
|
|
},
|
|
|
|
|
2020-05-16 20:09:14 +02: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-05-14 21:58:25 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- CSSMin Config --------------------------------------------------------
|
2013-05-14 22:59:18 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
cssmin: {
|
2013-05-14 22:59:18 +02:00
|
|
|
options: {
|
2020-05-16 20:09:14 +02:00
|
|
|
noAdvanced: true
|
2013-05-14 22:59:18 +02:00
|
|
|
},
|
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
files: {
|
|
|
|
expand: true,
|
|
|
|
src : 'build/*.css',
|
|
|
|
ext : '-min.css'
|
|
|
|
}
|
2013-05-14 22:59:18 +02:00
|
|
|
},
|
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- Compress Config ------------------------------------------------------
|
2013-05-14 22:59:18 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
compress: {
|
|
|
|
release: {
|
|
|
|
options: {
|
|
|
|
archive: 'release/<%= pkg.version %>/<%= nick %>-<%= pkg.version %>.tar.gz'
|
|
|
|
},
|
2013-05-14 22:59:18 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
expand : true,
|
|
|
|
flatten: true,
|
|
|
|
src : 'build/*',
|
|
|
|
dest : '<%= nick %>/<%= pkg.version %>/'
|
|
|
|
}
|
|
|
|
},
|
2013-05-14 19:12:01 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- License Config -------------------------------------------------------
|
|
|
|
|
|
|
|
license: {
|
|
|
|
normalize: {
|
|
|
|
options: {
|
|
|
|
banner: [
|
|
|
|
'/*!',
|
2022-04-28 18:54:43 +02:00
|
|
|
'normalize.css v<%= pkg.devDependencies["normalize-css"] %> | MIT License | https://necolas.github.io/normalize.css/',
|
2020-05-16 20:09:14 +02:00
|
|
|
'Copyright (c) Nicolas Gallagher and Jonathan Neal',
|
|
|
|
'*/\n'
|
|
|
|
].join('\n')
|
|
|
|
},
|
|
|
|
|
|
|
|
expand: true,
|
|
|
|
cwd : 'build/',
|
|
|
|
src : ['base*.css', '<%= nick %>*.css']
|
|
|
|
},
|
2013-05-14 19:12:01 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
yahoo: {
|
|
|
|
options: {
|
|
|
|
banner: [
|
|
|
|
'/*!',
|
|
|
|
'Pure v<%= pkg.version %>',
|
|
|
|
'Copyright 2013 Yahoo!',
|
|
|
|
'Licensed under the BSD License.',
|
2020-10-18 14:14:38 +02:00
|
|
|
'https://github.com/pure-css/pure/blob/master/LICENSE',
|
2020-05-16 20:09:14 +02:00
|
|
|
'*/\n'
|
|
|
|
].join('\n')
|
|
|
|
},
|
|
|
|
|
|
|
|
expand: true,
|
|
|
|
src : ['build/*.css']
|
2014-02-18 17:55:22 +01:00
|
|
|
}
|
2014-02-28 18:56:50 +01:00
|
|
|
},
|
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- Pure Grids Units Config ----------------------------------------------
|
2014-02-28 18:56:50 +01:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
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
|
2022-03-15 00:54:01 +01:00
|
|
|
xl: 'screen and (min-width: 80em)', // 1280px
|
|
|
|
xxl: 'screen and (min-width: 120em)' // 1920px
|
2020-05-16 20:09:14 +02:00
|
|
|
}
|
2014-02-28 18:56:50 +01:00
|
|
|
}
|
|
|
|
}
|
2020-05-16 20:09:14 +02:00
|
|
|
},
|
2013-11-18 20:46:19 +01:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- CSS Selectors Config -------------------------------------------------
|
2013-05-14 19:12:01 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
css_selectors: {
|
|
|
|
base: {
|
|
|
|
src : 'build/base.css',
|
|
|
|
dest: 'build/base-context.css',
|
2013-05-14 19:12:01 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
options: {
|
|
|
|
mutations: [{prefix: '.pure'}]
|
|
|
|
}
|
2013-05-09 23:56:32 +02:00
|
|
|
}
|
2020-05-16 20:09:14 +02:00
|
|
|
},
|
2013-06-06 00:51:10 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
// -- Watch/Observe Config -------------------------------------------------
|
2013-06-06 00:51:10 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
observe: {
|
|
|
|
src: {
|
|
|
|
files: 'src/**/css/*.css',
|
|
|
|
tasks: ['test', 'suppress', 'build'],
|
2013-06-06 00:51:10 +02:00
|
|
|
|
2020-05-16 20:09:14 +02:00
|
|
|
options: {
|
|
|
|
interrupt: true
|
|
|
|
}
|
2013-06-06 00:51:10 +02:00
|
|
|
}
|
|
|
|
}
|
2020-05-16 20:09:14 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// -- 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');
|
2022-03-14 20:46:54 +01:00
|
|
|
grunt.loadNpmTasks('@lodder/grunt-postcss');
|
2020-05-16 20:09:14 +02:00
|
|
|
grunt.loadNpmTasks('grunt-pure-grids');
|
|
|
|
|
|
|
|
// Local tasks.
|
|
|
|
grunt.loadTasks('tasks/');
|
|
|
|
|
|
|
|
grunt.registerTask('default', ['test', 'build']);
|
|
|
|
grunt.registerTask('test', ['csslint']);
|
|
|
|
grunt.registerTask('build', [
|
|
|
|
'clean:build',
|
|
|
|
'copy:build',
|
|
|
|
'pure_grids',
|
|
|
|
'concat:build',
|
|
|
|
'clean:build_res',
|
|
|
|
'css_selectors:base',
|
|
|
|
'postcss',
|
|
|
|
'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',
|
|
|
|
'compress:release'
|
|
|
|
]);
|
2013-05-14 21:58:25 +02:00
|
|
|
|
2013-05-09 23:56:32 +02:00
|
|
|
};
|