Skip to content

Commit

Permalink
build: migrate to gulp v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jun 28, 2019
1 parent 8881613 commit a1e0eb4
Show file tree
Hide file tree
Showing 3 changed files with 437 additions and 439 deletions.
26 changes: 12 additions & 14 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ const gulp = require('gulp')

const src = {
css: ['static/sass/style.scss'],
js: [
'node_modules/prismjs/prism.js',
'node_modules/prismjs/components/prism-json.js'
]
js: ['node_modules/prismjs/prism.js', 'node_modules/prismjs/components/prism-json.js']
}

const dist = {
Expand All @@ -24,7 +21,12 @@ const dist = {
}
}

gulp.task('css', () => {
function watch () {
gulp.watch(src.css, styles)
gulp.watch(src.js, scripts)
}

const styles = () =>
gulp
.src(src.css)
.pipe(
Expand All @@ -37,20 +39,16 @@ gulp.task('css', () => {
.pipe(strip({ all: true }))
.pipe(cssnano())
.pipe(gulp.dest(dist.path))
})

gulp.task('js', () => {
const scripts = () =>
gulp
.src(src.js)
.pipe(concat(`${dist.name.js}.min.js`))
.pipe(uglify())
.pipe(gulp.dest(dist.path))
})

gulp.task('build', ['css', 'js'])
const build = gulp.parallel(styles, scripts)

gulp.task('default', () => {
gulp.start(['build'])
gulp.watch(src.css, ['css'])
gulp.watch(src.js, ['js'])
})
module.exports.default = gulp.series(build, watch)
module.exports.build = build
module.exports.watch = watch
Loading

0 comments on commit a1e0eb4

Please sign in to comment.