mirror of
https://github.com/NigelOToole/pixel-borders.git
synced 2025-01-16 20:38:28 +01:00
Update to demo site tasks
This commit is contained in:
parent
e5a792536a
commit
950e8db58e
15
gulpfile.js
15
gulpfile.js
@ -5,15 +5,8 @@ const $ = gulpLoadPlugins();
|
||||
const browserSync = require('browser-sync');
|
||||
const server = browserSync.create();
|
||||
const del = require('del');
|
||||
const { argv } = require('yargs');
|
||||
const autoprefixer = require('autoprefixer');
|
||||
|
||||
const port = argv.port || 9000;
|
||||
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
const isTest = process.env.NODE_ENV === 'test';
|
||||
const isDev = !isProd && !isTest;
|
||||
|
||||
const paths = {
|
||||
src: 'src',
|
||||
dest: 'docs',
|
||||
@ -25,7 +18,7 @@ const paths = {
|
||||
function styles() {
|
||||
return src(`${paths.src}/styles/*.scss`)
|
||||
.pipe($.plumber())
|
||||
.pipe($.if(!isProd, $.sourcemaps.init()))
|
||||
.pipe($.sourcemaps.init())
|
||||
.pipe($.sass.sync({
|
||||
outputStyle: 'expanded',
|
||||
precision: 10,
|
||||
@ -35,7 +28,7 @@ function styles() {
|
||||
.pipe($.postcss([
|
||||
autoprefixer()
|
||||
]))
|
||||
.pipe($.if(!isProd, $.sourcemaps.write()))
|
||||
.pipe($.sourcemaps.write())
|
||||
.pipe(dest(`${paths.tmp}/styles`))
|
||||
.pipe(server.reload({stream: true}));
|
||||
};
|
||||
@ -47,7 +40,7 @@ exports.styles = styles;
|
||||
function startAppServer() {
|
||||
server.init({
|
||||
notify: false,
|
||||
port,
|
||||
port: 9000,
|
||||
server: {
|
||||
baseDir: [`${paths.tmp}`, `${paths.src}`],
|
||||
routes: {
|
||||
@ -73,7 +66,7 @@ exports.serve = serve;
|
||||
|
||||
// ----- Build tasks ------
|
||||
function compress() {
|
||||
return src([`${paths.src}/*.html`, `${paths.tmp}/*/**/*.{html,css,js}`])
|
||||
return src([`${paths.tmp}/*/**/*.{html,css,js}`, `${paths.src}/**/*.{html,js,jpg,gif,png}`])
|
||||
.pipe(dest(`${paths.dest}`));
|
||||
}
|
||||
|
||||
|
@ -36,16 +36,14 @@
|
||||
"del": "^3.0.0",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-cli": "^2.0.1",
|
||||
"gulp-if": "^2.0.2",
|
||||
"gulp-load-plugins": "^1.6.0",
|
||||
"gulp-plumber": "^1.0.1",
|
||||
"gulp-postcss": "^8.0.0",
|
||||
"gulp-sass": "^4.0.2",
|
||||
"gulp-sourcemaps": "^2.2.0",
|
||||
"yargs": "^12.0.5"
|
||||
"gulp-sourcemaps": "^2.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "gulp serve",
|
||||
"build": "cross-env NODE_ENV=production gulp"
|
||||
"build": "gulp"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user