diff --git a/gulp/clean.js b/gulp/clean.js deleted file mode 100755 index ba3e7cdf9..000000000 --- a/gulp/clean.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - clean.js - =========== - removes folders: - - public -*/ - -const { rimrafSync } = require('rimraf') -const gulp = require('gulp') - -const config = require('./config.json') - -gulp.task('clean', (done) => { - rimrafSync([config.paths.public, '.port.tmp']) - return done() -}) diff --git a/gulp/config.json b/gulp/config.json deleted file mode 100755 index d528fc4b5..000000000 --- a/gulp/config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "paths": { - "public": "public/", - "assets" : "app/assets/", - "nodeModules": "node_modules/", - "lib": "lib/" - } -} diff --git a/gulp/copy-assets.js b/gulp/copy-assets.js deleted file mode 100755 index f17028285..000000000 --- a/gulp/copy-assets.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - copy.js - =========== - copies images and javascript folders to public -*/ - -const gulp = require('gulp') - -const config = require('./config.json') - -gulp.task('copy-images', () => { - return gulp.src( - config.paths.assets + 'images/*.+(png|jpg|jpeg|gif|svg|ico)', - { encoding: false } - ) - .pipe(gulp.dest(config.paths.public + 'images/')) -}) - -gulp.task('copy-javascripts', () => { - return gulp.src(config.paths.assets + 'javascripts/*') - .pipe(gulp.dest(config.paths.public + 'javascripts/')) -}) - -gulp.task('copy-data', () => { - return gulp.src(config.paths.assets + 'data/**') - .pipe(gulp.dest(config.paths.public + 'data/')) -}) - -gulp.task('copy-downloads', () => { - return gulp.src(config.paths.assets + 'downloads/**') - .pipe(gulp.dest(config.paths.public + 'downloads/')) -}) diff --git a/gulp/nodemon.js b/gulp/nodemon.js deleted file mode 100755 index 956ba93ab..000000000 --- a/gulp/nodemon.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - nodemon.js - =========== - uses nodemon to run a server, watches for javascript and json changes -*/ - -const fs = require('fs') -const path = require('path') - -const gulp = require('gulp') -const colour = require('ansi-colors') -const log = require('fancy-log') -const nodemon = require('gulp-nodemon') - -const config = require('./config.json') - -// Warn about npm install on crash -const onCrash = () => { - log(colour.cyan('[nodemon] For missing modules try running `npm install`')) -} - -// Remove .port.tmp if it exists -const onQuit = () => { - try { - fs.unlinkSync(path.join(__dirname, '/../.port.tmp')) - } catch (e) {} - - process.exit(0) -} - -gulp.task('server', () => { - nodemon({ - watch: ['.env', '**/*.js', '**/*.json'], - script: 'listen-on-port.js', - ignore: [ - config.paths.public + '*', - config.paths.assets + '*', - config.paths.nodeModules + '*' - ] - }) - .on('crash', onCrash) - .on('quit', onQuit) -}) diff --git a/gulp/sass.js b/gulp/sass.js deleted file mode 100755 index 60166fdea..000000000 --- a/gulp/sass.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - sass.js - =========== - compiles sass from assets folder - also includes sourcemaps -*/ - -const gulp = require('gulp') -const sass = require('gulp-sass')(require('sass')) -const sourcemaps = require('gulp-sourcemaps') -const path = require('path') -const fs = require('fs') - -const extensions = require('../lib/extensions/extensions') -const config = require('./config.json') -const stylesheetDirectory = config.paths.public + 'stylesheets' - -gulp.task('sass-extensions', (done) => { - const fileContents = '$govuk-extensions-url-context: "/extension-assets"; ' + extensions.getFileSystemPaths('sass') - .map(filePath => `@import "${filePath.split(path.sep).join('/')}";`) - .join('\n') - fs.writeFile(path.join(config.paths.lib + 'extensions', '_extensions.scss'), fileContents, done) -}) - -gulp.task('sass', () => { - return gulp.src(config.paths.assets + '/sass/*.scss') - .pipe(sourcemaps.init()) - .pipe(sass({ outputStyle: 'expanded' }).on('error', (error) => { - // write a blank application.css to force browser refresh on error - if (!fs.existsSync(stylesheetDirectory)) { - fs.mkdirSync(stylesheetDirectory) - } - fs.writeFileSync(path.join(stylesheetDirectory, 'application.css'), '') - console.error('\n', error.messageFormatted, '\n') - this.emit('end') - })) - .pipe(sourcemaps.write()) - .pipe(gulp.dest(stylesheetDirectory)) -}) diff --git a/gulp/school-search-index.js b/gulp/school-search-index.js deleted file mode 100644 index 40bf5eb78..000000000 --- a/gulp/school-search-index.js +++ /dev/null @@ -1,9 +0,0 @@ -const gulp = require('gulp') -const lunr = require('./../scripts/generate-search-index') // generate - -gulp.task('school-search-index', (done) => { - // Generate search index - lunr() - - done() -}) diff --git a/gulp/watch.js b/gulp/watch.js deleted file mode 100755 index 727448a4b..000000000 --- a/gulp/watch.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - watch.js - =========== - watches sass/js/images -*/ - -const gulp = require('gulp') - -const config = require('./config.json') - -gulp.task('watch-sass', () => { - return gulp.watch(config.paths.assets + 'sass/**', { cwd: './' }, gulp.task('sass')) -}) - -gulp.task('watch-assets', () => { - return gulp.watch([ - config.paths.assets + 'images/**', - config.paths.assets + 'javascripts/**' - ], { cwd: './' }, gulp.task('copy-assets')) -}) diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100755 index b2aceb70c..000000000 --- a/gulpfile.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - gulpfile.js - =========== - Rather than manage one giant configuration file responsible - for creating multiple tasks, each task has been broken out into - its own file in `/gulp`. Any files in that directory - get automatically required below. - To add a new task, simply add a new task file that directory. -*/ - -const gulp = require('gulp') -const requireDir = require('require-dir') - -// Require all tasks in gulp/tasks, including subfolders -requireDir('./gulp', { recurse: true }) - -// gulp 4 requires dependency tasks to be defined before they are called. -// We'll keep our top-level tasks in this file so that they are defined at the end of the chain, after their dependencies. -gulp.task('generate-assets', gulp.series( - 'clean', - 'sass-extensions', - 'school-search-index', - gulp.parallel( - 'sass', - 'copy-images', - 'copy-javascripts', - 'copy-data', - 'copy-downloads' - ) -)) -gulp.task('watch', gulp.parallel( - 'watch-sass', - 'watch-assets' -)) -gulp.task('default', gulp.series( - 'generate-assets', - gulp.parallel( - 'watch', - 'server' - ) -))