Skip to content

Commit

Permalink
Slightly cleanup Gruntfile.js
Browse files Browse the repository at this point in the history
  • Loading branch information
limzykenneth committed Jan 6, 2020
1 parent 18b25d2 commit 2a8ef01
Showing 1 changed file with 33 additions and 35 deletions.
68 changes: 33 additions & 35 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ module.exports = function(grunt) {
files: '<%= config.src %>/assets/css/*.css',
tasks: [
'concat:dist',
// 'uncss',
'postcss'
]
},
Expand Down Expand Up @@ -121,7 +120,7 @@ module.exports = function(grunt) {
}
},
dest: '<%= config.dist %>',
src: "!*.*"
src: '!*.*'
}
},

Expand Down Expand Up @@ -161,7 +160,7 @@ module.exports = function(grunt) {
// CSS:
concat: {
options: {
separator: ';',
separator: ';'
},
dist: {
src: [
Expand All @@ -174,21 +173,20 @@ module.exports = function(grunt) {
},
postcss: {
options: {
map: true,
map: {
inline: false,
annotation: '<%= config.dist %>/assets/css/maps/'
},
processors: [
require('autoprefixer')({browsers: [
"Android 2.3",
"Android >= 4",
"Chrome >= 20",
"Firefox >= 24",
"Explorer >= 8",
"iOS >= 6",
"Opera >= 12",
"Safari >= 6"
'Android 2.3',
'Android >= 4',
'Chrome >= 20',
'Firefox >= 24',
'Explorer >= 8',
'iOS >= 6',
'Opera >= 12',
'Safari >= 6'
]}),
require('cssnano')()
]
Expand Down Expand Up @@ -227,7 +225,7 @@ module.exports = function(grunt) {
examples: {
expand: true,
cwd: '<%= config.src %>/data/examples',
src: ['**', '!build_examples/**' ],
src: ['**', '!build_examples/**'],
dest: '<%= config.dist %>/assets/examples'
},
contributor_docs: {
Expand Down Expand Up @@ -307,7 +305,7 @@ module.exports = function(grunt) {
default_options: {
files: [
{
prepend: "referenceData = ",
prepend: 'referenceData = ',
input: '<%= config.src %>/templates/pages/reference/data.json',
output: '<%= config.src %>/offline-reference/js/data.js'
}
Expand All @@ -325,28 +323,32 @@ module.exports = function(grunt) {
src: ['**/*'],
dest: 'p5-reference/'
}
},
},
htmllint: {
all: {
src: ['<%= config.dist %>/**/*.html',
'!<%= config.dist %>/es/**/*.html',
'!<%= config.dist %>/zh-Hans/**/*.html',
'!<%= config.dist %>/**/CHANGES.html',
'!<%= config.dist %>/**/README.html',
'!<%= config.dist %>/**/p5_featured/**/*.html',
'!<%= config.dist %>/**/learn/*.html',
'!<%= config.dist %>/**/examples/*.html',
'!<%= config.dist %>/reference/assets/index.html'],
src: [
'<%= config.dist %>/**/*.html',
'!<%= config.dist %>/es/**/*.html',
'!<%= config.dist %>/zh-Hans/**/*.html',
'!<%= config.dist %>/**/CHANGES.html',
'!<%= config.dist %>/**/README.html',
'!<%= config.dist %>/**/p5_featured/**/*.html',
'!<%= config.dist %>/**/learn/*.html',
'!<%= config.dist %>/**/examples/*.html',
'!<%= config.dist %>/reference/assets/index.html'
],
options: {
ignore: [/^This document appears to be written in English/,
/^Bad value https:/,
/^Consider adding a lang attribute to the html/]
ignore: [
/^This document appears to be written in English/,
/^Bad value https:/,
/^Consider adding a lang attribute to the html/
]
}
}
}
});

grunt.registerTask('update-version', function(){
grunt.registerTask('update-version', function() {
const done = this.async();

const version = require('./src/templates/pages/reference/data.json').project.version;
Expand Down Expand Up @@ -386,14 +388,13 @@ module.exports = function(grunt) {
grunt.registerTask('optimize', [
'newer:imagemin',
'concat:dist',
// 'uncss',
'postcss'
]);

// i18n tracking task
grunt.registerTask('i18n', function(){
grunt.registerTask('i18n', function() {
var done = this.async();
require("./i18n.js")(done);
require('./i18n.js')(done);
});

// runs tasks in order
Expand All @@ -412,8 +413,5 @@ module.exports = function(grunt) {
]);

// runs with just grunt command
grunt.registerTask('default', [
'build'
]);

grunt.registerTask('default', ['build']);
};

0 comments on commit 2a8ef01

Please sign in to comment.