-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
39 lines (33 loc) · 1017 Bytes
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { exec } = require('child_process');
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
dist: ['dist/']
},
copy: {
images: {
expand: true,
cwd: 'assets/',
src: ['*.svg'],
dest: 'dist/'
}
}
});
grunt.registerTask('postcss-cli', 'Run PostCSS CLI', function() {
const done = this.async();
exec('npx postcss assets/oag.css --use postcss-nested --use postcss-custom-properties --use autoprefixer --use cssnano -o dist/oag.min.css --no-map', (err, stdout, stderr) => {
if (err) {
grunt.log.error(stderr);
done(false);
} else {
grunt.log.writeln(stdout);
}
});
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['clean', 'copy', 'postcss-cli']);
};