Skip to content

Commit

Permalink
Moved from grunt to gulp tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
htmlandbacon authored and gemmaleigh committed Oct 14, 2016
1 parent fb45d4f commit b3bcb98
Show file tree
Hide file tree
Showing 15 changed files with 190 additions and 169 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
language: node_js
node_js:
- 4.0
before_install:
- npm install -g grunt-cli
install:
- npm install
script:
- "./node_modules/grunt-cli/bin/grunt test"
- "./node_modules/gulp/bin/gulp test"
- npm test
after_success:
- "./create-release-tag.sh"
Expand Down
148 changes: 0 additions & 148 deletions Gruntfile.js

This file was deleted.

2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: node ./node_modules/grunt-cli/bin/grunt --gruntfile Gruntfile.js generate-assets && node server.js
web: node ./node_modules/gulp/bin/gulp generate-assets && node server.js
5 changes: 3 additions & 2 deletions docs/documentation/install/install-the-kit.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ To check you’re in the right folder, you can run `ls` (list items):
```
ls
```
You should see a list of files inside the prototype, starting with `CHANGELOG.md, CONTRIBUTING.md, Gruntfile.js etc`
You should see a list of files inside the prototype, starting with `CHANGELOG.md, CONTRIBUTING.md, gulpfile.js etc`

> If you don’t see these files, check that you installed the kit into the right location and named it correctly.
Expand All @@ -87,4 +87,5 @@ npm install
```
The install may take up to a minute. Whilst installing it may `WARN` about some items - this is ok. As long as there are no `ERROR`s you can continue.

<a href="run-the-kit.md" class="button">Next (run the kit)</a>

<a href="run-the-kit.md" class="button">Next (run the kit)</a>
15 changes: 15 additions & 0 deletions gulp/clear.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
clear.js
===========
removes public folder/govuk_modules folder
*/
var config = require('./config.json')

var gulp = require('gulp')
var clean = require('gulp-clean')

gulp.task('clear', function () {
return gulp.src([config.assets.output + '/*',
config.assets.govuk_modules + '/*'], {read: false})
.pipe(clean())
})
8 changes: 8 additions & 0 deletions gulp/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"assets": {
"output": "public/",
"base" : "app/assets/",
"govuk_modules": "govuk_modules/",
"lib": "lib/"
}
}
13 changes: 13 additions & 0 deletions gulp/copy-assets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
copy.js
===========
copies images and javascript folders to public
*/

var gulp = require('gulp')
var config = require('./config.json')

gulp.task('copy-assets', function () {
return gulp.src(['!' + config.assets.base + 'sass{,/**/*}', config.assets.base + '/**'])
.pipe(gulp.dest(config.assets.output))
})
29 changes: 29 additions & 0 deletions gulp/copy-modules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
copy-gov-modules.js
===========
copies files for node_modules into govuk_modules
*/

var gulp = require('gulp')
var config = require('./config.json')

gulp.task('copy-toolkit', function () {
return gulp.src(['node_modules/govuk_frontend_toolkit/**'])
.pipe(gulp.dest(config.assets.govuk_modules + '/govuk_frontend_toolkit/'))
})

gulp.task('copy-template', function () {
return gulp.src(['node_modules/govuk_template_jinja/views/layouts/**'])
.pipe(gulp.dest(config.assets.govuk_modules + '/govuk_template/layouts/'))
.pipe(gulp.dest(config.assets.lib))
})

gulp.task('copy-template-assets', function () {
return gulp.src(['node_modules/govuk_template_jinja/assets/**'])
.pipe(gulp.dest(config.assets.govuk_modules + '/govuk_template/assets/'))
})

gulp.task('copy-elements-sass', function () {
return gulp.src(['node_modules/govuk-elements-sass/public/sass/**'])
.pipe(gulp.dest(config.assets.govuk_modules + '/govuk-elements-sass/'))
})
16 changes: 16 additions & 0 deletions gulp/nodemon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
nodemon.js
===========
uses nodemon to run a server, watches for javascript and json changes
*/

var gulp = require('gulp')
var nodemon = require('gulp-nodemon')
var config = require('./config.json')

gulp.task('server', function () {
nodemon({ignore: [config.assets.output + '*', config.assets.output + '*'],
script: 'server.js',
ext: 'js, json',
env: {NODE_ENV: 'development'}})
})
23 changes: 23 additions & 0 deletions gulp/sass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
sass.js
===========
compiles sass from assets folder with the govuk_modules
also includes sourcemaps
*/

var gulp = require('gulp')
var sass = require('gulp-sass')
var sourcemaps = require('gulp-sourcemaps')

var config = require('./config.json')

gulp.task('sass', function () {
return gulp.src(config.assets.base + '/sass/*.scss')
.pipe(sass({outputStyle: 'expanded',
includePaths: ['govuk_modules/govuk_frontend_toolkit/stylesheets',
'govuk_modules/govuk_template/assets/stylesheets',
'govuk_modules/govuk-elements-sass/']}).on('error', sass.logError))
.pipe(sourcemaps.init())
.pipe(sourcemaps.write())
.pipe(gulp.dest(config.assets.output + '/stylesheets/'))
})
39 changes: 39 additions & 0 deletions gulp/tasks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
tasks.js
===========
defaults wraps generate-assets, watch and server
*/

var gulp = require('gulp')
var gutil = require('gulp-util')
var runSequence = require('run-sequence')

gulp.task('default', function (done) {
runSequence('generate-assets',
'watch',
'server', done)
})

gulp.task('generate-assets', function (done) {
runSequence('clear',
'copy-govuk-modules',
'sass',
'copy-assets', done)
})

gulp.task('copy-govuk-modules', function (done) {
runSequence(['copy-toolkit',
'copy-template-assets',
'copy-elements-sass',
'copy-template'], done)
})

gulp.task('watch', function (done) {
runSequence('watch-sass',
'watch-assets', done)
})

gulp.task('test', function (done) {
gutil.log('Test that the app runs')
done()
})
17 changes: 17 additions & 0 deletions gulp/watch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
watch.js
===========
watches sass/js/images
*/

var gulp = require('gulp')
var config = require('./config.json')

gulp.task('watch-sass', function () {
return gulp.watch(config.assets.base + 'sass/**', {cwd: './'}, ['sass'])
})

gulp.task('watch-assets', function () {
return gulp.watch([config.assets.base + 'images/**',
config.assets.base + 'javascripts/**'], {cwd: './'}, ['copy'])
})
16 changes: 16 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
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.
`/gulp/tasks.js` specifies the default set of
tasks to run when you run `gulp`.
*/

var requireDir = require('require-dir')

// Require all tasks in gulp/tasks, including subfolders
requireDir('./gulp', {recurse: true})
Loading

0 comments on commit b3bcb98

Please sign in to comment.