This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/gulpfile.coffee

55 lines
1.6 KiB
CoffeeScript
Raw Normal View History

2016-05-28 16:41:41 +00:00
'use strict'
global.gulp = require 'gulp'
global.plugins = require('gulp-load-plugins')()
global.config =
autoprefixer:
browsers: 'last 2 versions'
2016-05-28 20:53:08 +00:00
bowerDir: 'vendor/bower'
2016-05-28 16:41:41 +00:00
fonts:
outputDir: 'source/assets/fonts'
htmlmin:
collapseWhitespace: true
js:
2016-05-28 20:53:08 +00:00
sourceDir: 'assets/js'
pattern: '/**/*.js'
2016-05-28 16:41:41 +00:00
outputDir: 'source/assets/js'
production: plugins.util.env.production || false
sass:
2016-05-28 20:53:08 +00:00
sourceDir: 'assets/sass'
pattern: '/**/*.sass'
2016-05-28 16:41:41 +00:00
outputDir: 'source/assets/css'
scss:
pattern: '/**/*.scss'
global.app = {}
app.sass = (paths, filename) ->
gulp.src paths
.pipe plugins.plumber()
.pipe plugins.if !config.production, plugins.sourcemaps.init()
.pipe plugins.sassGlob()
.pipe plugins.sass()
.pipe plugins.autoprefixer config.autoprefixer
.pipe plugins.concat filename
.pipe plugins.if config.production, plugins.cleanCss()
.pipe plugins.if !config.production, plugins.sourcemaps.write('.')
.pipe plugins.if !config.production, plugins.refresh()
.pipe gulp.dest config.sass.outputDir
app.js = (paths, filename) ->
gulp.src paths
.pipe plugins.plumber()
.pipe plugins.if !config.production, plugins.sourcemaps.init()
.pipe plugins.concat filename
.pipe plugins.if config.production, plugins.uglify()
.pipe plugins.if !config.production, plugins.sourcemaps.write('.')
.pipe gulp.dest config.js.outputDir
app.copy = (source, destination) ->
gulp.src source
.pipe gulp.dest destination
require('require-dir')('./gulp')