-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2863 from alphagov/lint-separately
Separate out CSS/JS lint tasks from `copy-assets`
- Loading branch information
Showing
14 changed files
with
214 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
* text=auto eol=lf | ||
*.min.js diff=minjs | ||
*.min.css diff=mincss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,100 @@ | ||
const paths = require('./config/paths.js') | ||
const gulp = require('gulp') | ||
const taskListing = require('gulp-task-listing') | ||
const configPaths = require('./config/paths.js') | ||
const taskArguments = require('./tasks/task-arguments') | ||
|
||
// Gulp sub-tasks | ||
require('./tasks/gulp/compile-assets.js') | ||
require('./tasks/gulp/lint.js') | ||
require('./tasks/gulp/watch.js') | ||
// new tasks | ||
require('./tasks/gulp/copy-to-destination.js') | ||
require('./tasks/gulp/watch.js') | ||
|
||
// Node tasks | ||
const buildSassdocs = require('./tasks/sassdoc.js') | ||
const runNodemon = require('./tasks/nodemon.js') | ||
const updateDistAssetsVersion = require('./tasks/asset-version.js') | ||
const { buildSassdocs } = require('./tasks/sassdoc.js') | ||
const { runNodemon } = require('./tasks/nodemon.js') | ||
const { updateDistAssetsVersion } = require('./tasks/asset-version.js') | ||
const { cleanDist, cleanPackage, cleanPublic } = require('./tasks/clean.js') | ||
const { npmScriptTask } = require('./tasks/run.js') | ||
|
||
// Umbrella scripts tasks for preview --- | ||
// Runs js lint and compilation | ||
// -------------------------------------- | ||
/** | ||
* Umbrella scripts tasks (for watch) | ||
* Runs JavaScript code quality checks and compilation | ||
*/ | ||
gulp.task('scripts', gulp.series( | ||
'js:lint', | ||
npmScriptTask('lint:js', ['--silent']), | ||
'js:compile' | ||
)) | ||
|
||
// Umbrella styles tasks for preview ---- | ||
// Runs scss lint and compilation | ||
// -------------------------------------- | ||
/** | ||
* Umbrella styles tasks (for watch) | ||
* Runs Sass code quality checks and compilation | ||
*/ | ||
gulp.task('styles', gulp.series( | ||
'scss:lint', | ||
npmScriptTask('lint:scss', ['--silent']), | ||
'scss:compile' | ||
)) | ||
|
||
// Copy assets task ---------------------- | ||
// Copies assets to taskArguments.destination (public) | ||
// -------------------------------------- | ||
/** | ||
* Copy assets task | ||
* Copies assets to taskArguments.destination (public) | ||
*/ | ||
gulp.task('copy:assets', () => { | ||
return gulp.src(paths.src + 'assets/**/*') | ||
return gulp.src(configPaths.src + 'assets/**/*') | ||
.pipe(gulp.dest(taskArguments.destination + '/assets/')) | ||
}) | ||
|
||
// Copy assets task for local & heroku -- | ||
// Copies files to | ||
// taskArguments.destination (public) | ||
// -------------------------------------- | ||
gulp.task('copy-assets', gulp.series( | ||
'styles', | ||
'scripts' | ||
/** | ||
* Compile task for local & heroku | ||
* Runs JavaScript and Sass compilation, including Sass documentation | ||
*/ | ||
gulp.task('compile', gulp.series( | ||
'js:compile', | ||
'scss:compile', | ||
buildSassdocs | ||
)) | ||
|
||
// Serve task --------------------------- | ||
// Restarts node app when there is changed | ||
// affecting js, css or njk files | ||
// -------------------------------------- | ||
/** | ||
* Serve task | ||
* Restarts Node.js app when there are changes | ||
* affecting .js, .mjs and .json files | ||
*/ | ||
gulp.task('serve', gulp.parallel( | ||
'watch', | ||
runNodemon | ||
)) | ||
|
||
// Dev task ----------------------------- | ||
// Runs a sequence of task on start | ||
// -------------------------------------- | ||
/** | ||
* Dev task | ||
* Runs a sequence of tasks on start | ||
*/ | ||
gulp.task('dev', gulp.series( | ||
cleanPublic, | ||
'copy-assets', | ||
buildSassdocs, | ||
'compile', | ||
'serve' | ||
)) | ||
|
||
// Build package task ----------------- | ||
// Prepare package folder for publishing | ||
// ------------------------------------- | ||
/** | ||
* Build package task | ||
* Prepare package folder for publishing | ||
*/ | ||
gulp.task('build:package', gulp.series( | ||
cleanPackage, | ||
'copy-files', | ||
'copy:files', | ||
'js:compile' | ||
)) | ||
|
||
/** | ||
* Build dist task | ||
* Prepare dist folder for release | ||
*/ | ||
gulp.task('build:dist', gulp.series( | ||
cleanDist, | ||
'copy-assets', | ||
'compile', | ||
'copy:assets', | ||
updateDistAssetsVersion | ||
)) | ||
|
||
gulp.task('sassdoc', buildSassdocs) | ||
|
||
// Default task ------------------------- | ||
// Lists out available tasks. | ||
// -------------------------------------- | ||
/** | ||
* Default task | ||
* Lists out available tasks | ||
*/ | ||
gulp.task('default', taskListing) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.