Permalink
Browse files

change from es5 to es6

  • Loading branch information...
featherplain committed Sep 4, 2016
1 parent 0befc92 commit 59338cfe218ceca5ad88ff9a9e98f8245cdb201f
Showing with 222 additions and 165 deletions.
  1. +18 −0 .eslintrc.json
  2. +69 −0 gulp/compile.js
  3. +28 −0 gulp/config.js
  4. +62 −0 gulp/docs.js
  5. +38 −0 gulpfile.babel.js
  6. +0 −165 gulpfile.js
  7. +7 −0 package.json
@@ -0,0 +1,18 @@
{
"env": {
"browser": false,
"node": true,
"es6": true
},
"extends": ["eslint:recommended"],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"no-console": ["error", {
"allow": ["log", "debug", "error"]
}],
"no-unused-vars": 1
}
}
@@ -0,0 +1,69 @@
'use strict';

//---------------------------------------------------------------------------
// Dependences
//---------------------------------------------------------------------------
import paths from './config';

import gulp from 'gulp';
import sketch from 'gulp-sketch';
import cleanCss from 'gulp-clean-css';
import rename from 'gulp-rename';
import svgSprite from 'gulp-svg-sprite';

import del from 'del';

//---------------------------------------------------------------------------
// Delete
//---------------------------------------------------------------------------
gulp.task('clean', del.bind(null, [
paths.srcSvg + '*.svg',
paths.destSvg + '*.svg',
paths.destFonts + '*.*',
paths.destScss + '*.scss',
paths.destCss + '*.css',
paths.srcJade + 'imc/modules/*.jade'
]));

//---------------------------------------------------------------------------
// Export artboards in Sketch to svg icons
//---------------------------------------------------------------------------
gulp.task('export:svg', () => {
return gulp.src(paths.sketch)
.pipe(sketch({
export: 'artboards',
formats: 'svg',
compact: true
}))
.pipe(gulp.dest(paths.srcSvg));
});

//---------------------------------------------------------------------------
// minify css file
//---------------------------------------------------------------------------
gulp.task('minify:css', () => {
gulp.src(paths.destCss + '*.css')
.pipe(cleanCss())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(paths.destCss))
.pipe(gulp.dest(paths.docs + 'css/'));
});

//---------------------------------------------------------------------------
// Generate sprite svg file
//---------------------------------------------------------------------------
gulp.task('sprite:svg', () => {
return gulp.src(paths.srcSvg + '*.svg')
.pipe(svgSprite({
dest: './',
mode: { symbol: { dest: './' } }
}))
.pipe(rename({
basename: 'feathericon',
dirname: './',
prefix: 'sprite' + '.'
}))
.pipe(gulp.dest(paths.destSvg));
});
@@ -0,0 +1,28 @@
'use strict';

//---------------------------------------------------------------------------
// File Destinations
//---------------------------------------------------------------------------

export default {
// dir
'root' : './',
'build' : 'build/',
'docs' : 'docs/',
// sketch
'sketch' : 'src/*.sketch',
//svg
'srcSvg' : 'src/svg/',
'destSvg' : 'build/svg/',
// templates
'templates' : 'src/templates/',
// fonts
'destFonts' : 'build/fonts/',
// scss
'destScss' : 'build/scss/',
'srcScss' : 'src/scss/',
// css
'destCss' : 'build/css/',
// jade
'srcJade' : 'src/jade/'
}
@@ -0,0 +1,62 @@
'use strict';

//---------------------------------------------------------------------------
// Dependences
//---------------------------------------------------------------------------
import paths from './config';

import gulp from 'gulp';
import jade from 'gulp-jade';
import data from 'gulp-data';
import plumber from 'gulp-plumber';
import sass from 'gulp-sass';
import cssGlobbing from 'gulp-css-globbing';
import autoprefixer from 'gulp-autoprefixer';

import browserSync from 'browser-sync';

//---------------------------------------------------------------------------
// BrowserSync
//---------------------------------------------------------------------------
gulp.task('browserSync', () => {
browserSync.init({
server: {
baseDir: paths.docs
}
});
});

gulp.task('bs:reload', () => {
browserSync.reload()
});


//---------------------------------------------------------------------------
// Jade
//---------------------------------------------------------------------------
gulp.task('jade', () => {
return gulp.src(paths.srcJade + '*.jade')
.pipe(data(() => require('../setting.json')))
.pipe(plumber())
.pipe(jade({ pretty: true }))
.pipe(gulp.dest(paths.docs))
.pipe(browserSync.reload({ stream: true }));
});

//---------------------------------------------------------------------------
// Sass
//---------------------------------------------------------------------------
gulp.task('sass', () => {
return gulp.src(paths.srcScss + '**/*.scss')
.pipe(cssGlobbing({ extensions: ['.scss'] }))
.pipe(sass({
loadPath : [],
outputStyle : 'compressed'
}).on('error', sass.logError))
.pipe(autoprefixer({
browsers: 'last 2 versions',
cascade: false
}))
.pipe(gulp.dest(paths.docs + 'css/'))
.pipe(browserSync.reload({ stream: true }));
});
@@ -0,0 +1,38 @@
'use strict';

//---------------------------------------------------------------------------
// Dependences
//---------------------------------------------------------------------------
import paths from './gulp/config';

import gulp from 'gulp';
import rs from 'run-sequence';

import './gulp/docs';
import './gulp/compile';

//---------------------------------------------------------------------------
// Gulp Tasks
//---------------------------------------------------------------------------
gulp.task('before:compile',() => {
rs('clean', 'export:svg');
});

gulp.task('after:compile', () => {
rs('minify:css', 'sprite:svg');
});

gulp.task('watch', () => {
gulp.watch([paths.srcSvg], ['sprite:svg']);
gulp.watch([paths.docs + '*.html'], ['bs:reload']);
gulp.watch([paths.srcJade + '**/*.jade'], ['jade']);
gulp.watch([paths.srcScss + '**/*.scss'], ['sass']);
});

gulp.task('server', [
'browserSync',
'bs:reload',
'jade',
'sass',
'watch'
]);

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 59338cf

Please sign in to comment.