From 283ed2670b7771d80a6a0125e674146142625b09 Mon Sep 17 00:00:00 2001 From: Marcos Moura Date: Mon, 11 Jul 2016 11:33:54 -0300 Subject: [PATCH] Improve gulp tasks --- demo/index.html | 2 +- gulpfile.babel.js/tasks/browserify.js | 14 ++++++++------ gulpfile.babel.js/tasks/copy.js | 2 -- gulpfile.babel.js/tasks/watch.js | 2 +- package.json | 10 +++++----- src/components/mdIcon/index.js | 10 ++-------- src/components/mdIcon/mdIcon.vue | 6 ++++++ 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/demo/index.html b/demo/index.html index e394702..c787f41 100644 --- a/demo/index.html +++ b/demo/index.html @@ -48,7 +48,7 @@ -
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo diff --git a/gulpfile.babel.js/tasks/browserify.js b/gulpfile.babel.js/tasks/browserify.js index 06c420c..9e9cb60 100644 --- a/gulpfile.babel.js/tasks/browserify.js +++ b/gulpfile.babel.js/tasks/browserify.js @@ -6,7 +6,6 @@ import watchify from 'watchify'; import babelify from 'babelify'; import envify from 'envify/custom'; import vueify from 'vueify'; -import xtend from 'xtend'; import prettyTime from 'pretty-hrtime'; import browserify from 'browserify'; import uglifyify from 'uglifyify'; @@ -19,19 +18,22 @@ let app = 'main.js'; let entry = path.normalize(config.src.path + '/components/' + app); gulp.task('browserify', () => { - let b = watchify(browserify(xtend(watchify.args, { + let b = browserify({ + cache: {}, + packageCache: {}, debug: true, - watch: true, - fullPaths: true, - keepAlive: true, + detectGlobals: false, + extensions: ['js', 'json', 'vue'], + ignoreWatch: true, noparse: ['node_modules/**/*.js'], entries: entry - }))); + }); let bundle = () => { let bundleTimer = process.hrtime(); return b + .plugin(watchify) .transform(envify({ NODE_ENV: 'development' })) diff --git a/gulpfile.babel.js/tasks/copy.js b/gulpfile.babel.js/tasks/copy.js index 8aed4d7..4c32837 100644 --- a/gulpfile.babel.js/tasks/copy.js +++ b/gulpfile.babel.js/tasks/copy.js @@ -1,10 +1,8 @@ import gulp from 'gulp'; -import changed from 'gulp-changed'; import config from '../config'; gulp.task('copy', () => { return gulp .src(config.src.files) - .pipe(changed(config.dest.path)) .pipe(gulp.dest(config.dest.path)); }); diff --git a/gulpfile.babel.js/tasks/watch.js b/gulpfile.babel.js/tasks/watch.js index da3123d..0543adf 100644 --- a/gulpfile.babel.js/tasks/watch.js +++ b/gulpfile.babel.js/tasks/watch.js @@ -9,7 +9,7 @@ let watchConfig = { }; gulp.task('watch', ['browserSync'], () => { - watch(['.eslintrc', '.eslintignore'].concat(config.gulp.scripts, config.src.components), watchConfig, () => { + watch(['.eslintrc', '.eslintignore'], watchConfig, () => { runSequence('eslint-all'); }); diff --git a/package.json b/package.json index b575c0c..bfa9c38 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ ], "devDependencies": { "babel-core": "^6.10.4", - "babel-eslint": "^6.1.0", + "babel-eslint": "^6.1.2", "babel-plugin-transform-runtime": "^6.6.0", "babel-preset-es2015": "^6.6.0", "babel-preset-stage-0": "^6.5.0", @@ -30,7 +30,7 @@ "gulp-changed": "^1.3.0", "gulp-changed-in-place": "^2.0.3", "gulp-cssnano": "^2.1.1", - "gulp-eslint": "^2.0.0", + "gulp-eslint": "^3.0.1", "gulp-import-css": "^0.1.2", "gulp-sass": "^2.2.0", "gulp-size": "^2.1.0", @@ -39,16 +39,16 @@ "gulp-util": "^3.0.7", "gulp-watch": "^4.3.8", "pretty-hrtime": "^1.0.2", - "run-sequence": "^1.1.5", + "run-sequence": "^1.2.2", "sass-module-importer": "^1.2.0", "uglifyify": "^3.0.1", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0", - "vueify": "^8.5.4", + "vueify": "^8.7.0", "watchify": "^3.7.0", "xtend": "^4.0.1" }, "dependencies": { - "vue": "^1.0.25" + "vue": "^1.0.26" } } diff --git a/src/components/mdIcon/index.js b/src/components/mdIcon/index.js index afe885f..42102dc 100644 --- a/src/components/mdIcon/index.js +++ b/src/components/mdIcon/index.js @@ -1,11 +1,5 @@ -import './mdIcon.vue'; +import mdIcon from './mdIcon.vue'; export default function install(Vue) { - Vue.elementDirective('md-icon', { - bind: function() { - Vue.nextTick(() => { - this.el.classList.add('material-icons'); - }); - } - }); + Vue.component('md-icon', Vue.extend(mdIcon)); } diff --git a/src/components/mdIcon/mdIcon.vue b/src/components/mdIcon/mdIcon.vue index 0e6ac40..fe0819c 100644 --- a/src/components/mdIcon/mdIcon.vue +++ b/src/components/mdIcon/mdIcon.vue @@ -1 +1,7 @@ + +