From f20368f3151d006520e0f888e689da25b7a0822e Mon Sep 17 00:00:00 2001 From: pure-js Date: Fri, 25 Nov 2016 02:22:18 +0300 Subject: [PATCH] go to gulp --- README.md | 3 +++ gulp/config.js | 19 +++++++++++++++++++ gulp/tasks/build.js | 28 ++++++++++++++++++++++++++++ gulp/tasks/index.js | 5 +++++ gulpfile.js | 19 +++++++++++++++++++ package.json | 19 +++++++++---------- 6 files changed, 83 insertions(+), 10 deletions(-) create mode 100644 gulp/config.js create mode 100644 gulp/tasks/build.js create mode 100644 gulp/tasks/index.js create mode 100644 gulpfile.js diff --git a/README.md b/README.md index 2e4306a..54640b5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # Check browser Check browser version and show pop-up if version is less then recommended + + bower i + npm i diff --git a/gulp/config.js b/gulp/config.js new file mode 100644 index 0000000..7b85261 --- /dev/null +++ b/gulp/config.js @@ -0,0 +1,19 @@ +module.exports = { + paths: { + pug: 'demo/index.pug', + pugWatch: [ + 'demo/index.pug', + ], + styl: [ + 'stylesheets/old-browser.styl' + ], + stylWatch: [ + 'src/blocks/**/*.styl' + ], + copy: ['bower_components/prism/prism.js', 'bower_components/prism/themes/prism.css', 'src/check-browser.js'], + build: 'build/' + }, + names: { + css: 'app.min.css' + } +}; diff --git a/gulp/tasks/build.js b/gulp/tasks/build.js new file mode 100644 index 0000000..03409ce --- /dev/null +++ b/gulp/tasks/build.js @@ -0,0 +1,28 @@ +const gulp = require('gulp'), + config = require('../config'), + plugins = require('gulp-load-plugins')(); + +const build = gulp.parallel(html, css, copy); + +module.exports = build; + +function html() { + return gulp.src(config.paths.pug) + .pipe(plugins.pug({ + pretty: true + })) + .pipe(gulp.dest(config.paths.build)); +} + +function css() { + return gulp.src(config.paths.styl) + .pipe(plugins.stylus({ + 'include css': true + })) + .pipe(gulp.dest(config.paths.build)); +} + +function copy() { + return gulp.src(config.paths.copy) + .pipe(gulp.dest(config.paths.build)); +} diff --git a/gulp/tasks/index.js b/gulp/tasks/index.js new file mode 100644 index 0000000..641ea60 --- /dev/null +++ b/gulp/tasks/index.js @@ -0,0 +1,5 @@ +module.exports = require('require-dir')('.', { + camelcase: true, + recurse: true + } +); diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..a7ca0ca --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,19 @@ +const gulp = require('gulp'), + del = require('del'), + // config = require('./gulp/config'), + tasks = require('./gulp/tasks'), + plugins = require('gulp-load-plugins')(); + +gulp.task('build', tasks.build); + +const clean = () => del(['build']); + +exports.clean = clean; + +// gulp.task('deploy', () => +// gulp.src(paths.dist + '**/*') +// .pipe(plugins.ghPages()) +// ); + +// The default task (called when you run `gulp` from cli) +gulp.task('default', tasks.build); diff --git a/package.json b/package.json index 0bf67e4..e7596f1 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,7 @@ "description": "script to check browser version", "main": "src/check-browser.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "pug": "pug demo --out build", - "stylus": "stylus stylesheets/old-browser.styl -o build", - "copy1": "cp bower_components/prism/prism.js build", - "copy2": "cp bower_components/prism/themes/prism.css build", - "copy3": "cp src/check-browser.js build", - "build": "npm run pug && npm run stylus && npm run copy1 && npm run copy2 && npm run copy3", - "clean": "rm -rf build" + "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", @@ -27,8 +20,14 @@ }, "homepage": "https://github.com/pure-js/check-browser#readme", "devDependencies": { + "del": "^2.2.2", + "gulp-load-plugins": "^1.4.0", "jshint": "^2.8.0", - "pug": "^2.0.0-beta2", - "stylus": "^0.54.5" + "require-dir": "^0.3.1" + }, + "dependencies": { + "gulp": "github:gulpjs/gulp#4.0", + "gulp-pug": "^3.1.0", + "gulp-stylus": "^2.6.0" } }