Skip to content

Commit

Permalink
Use const where possible in grunt configuration code
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbenner committed Feb 17, 2024
1 parent fa68bb2 commit 72edd34
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ module.exports = function gruntConfig(grunt) {
dest: '<%= paths.build %>/<%= files.cat %>',
options: {
process: (content) => {
let replaceRegex = /\s\/\* \[POWERTIP CODE\] \*\//,
coreFile = grunt.file.read(grunt.template.process('<%= concat.core.dest %>'));
const replaceRegex = /\s\/\* \[POWERTIP CODE\] \*\//;
const coreFile = grunt.file.read(grunt.template.process('<%= concat.core.dest %>'));
return grunt.template.process(content).replace(replaceRegex, coreFile);
}
}
Expand All @@ -128,8 +128,8 @@ module.exports = function gruntConfig(grunt) {
dest: '<%= paths.build %>/',
options: {
process: (content) => {
let scriptsRegex = /<!-- begin-scripts -->(?:.*\r?\n\s)*<!-- end-scripts -->/,
builtScriptTag = '<script type="text/javascript" src="../<%= files.cat %>"></script>';
const scriptsRegex = /<!-- begin-scripts -->(?:.*\r?\n\s)*<!-- end-scripts -->/;
const builtScriptTag = '<script type="text/javascript" src="../<%= files.cat %>"></script>';
return content.replace(scriptsRegex, grunt.template.process(builtScriptTag));
}
}
Expand Down Expand Up @@ -234,13 +234,13 @@ module.exports = function gruntConfig(grunt) {

// custom task to build the gh-pages index.md file
grunt.registerTask('build:gh-pages', 'Create the gh-pages markdown.', () => {
let template = grunt.file.read('doc/gh-pages.template.md'),
data = {
pkg: grunt.file.readJSON('package.json'),
doc: grunt.file.read('doc/README.md'),
changelog: grunt.file.readYAML(grunt.template.process('<%= files.changelog %>'))
},
page = grunt.template.process(template, { data: data });
const template = grunt.file.read('doc/gh-pages.template.md');
const data = {
pkg: grunt.file.readJSON('package.json'),
doc: grunt.file.read('doc/README.md'),
changelog: grunt.file.readYAML(grunt.template.process('<%= files.changelog %>'))
};
const page = grunt.template.process(template, { data: data });
grunt.file.write('dist/index.md', page);
grunt.log.ok('gh-pages markdown created');
});
Expand Down

0 comments on commit 72edd34

Please sign in to comment.