個人用gulp 4.0 タスク設定
const tasks = require('gulp4-tasks')
const server = cb => {
tasks.BrowserSync('./dev', 8080, true)
cb()
}
exports.server = server
https://www.browsersync.io/docs/options#option-server
default false
const tasks = require('gulp4-tasks')
const opts = {
pretty: true,
locals: {
moment: require('moment')
},
filters: {
php: require('pug-php-filter')
},
ext: 'php'
}
const compilePug2Php = () => tasks.CompilePug('*.pug', 'path/dist', opts)
exports.compilePug2Php = compilePug2Php
bool
default true
object
object
string
const tasks = require('gulp4-tasks')
const opts = {
mqpack: true,
minify: false,
sort: true,
prefix: true,
removeComments: true
}
const createCss = () => tasks.CompileStylus('./*.styl', 'path/dist', opts)
exports.createCss = createCss
autoprefixer options -> https://github.com/browserslist/browserslist#readme
bool, string
default false
bool
default false
bool
default false
bool
bool
default false
bool
default true
glob or array
const tasks = require('gulp4-tasks')
const template = `
/*
Theme Name: <%= pkg.name %>
Theme URI: <%= pkg.homepage %>
Author: <%= pkg.author %>
Author URI: <%= pkg.homepage %>
Description: <%= pkg.description %>
Version: <%= pkg.version %>
*/
`
const data = { pkg: require('./package.json') }
const createWPStyleSheet = () => tasks.TemplateHeader(template, data, 'style.css', 'path/dist')
exports.createWPStyleSheet = createWPStyleSheet
const tasks = require('gulp4-tasks')
let config = require('./webpack.config')
const bundleJs = cb => {
config.mode = 'development'
config.devtool = 'source-map'
config.output = { filename: 'bundle.js' }
tasks.Webpack('path/js/src.js', 'path/dist', config)
cb()
}
exports.bundleJs = bundleJs