Skip to content

Commit

Permalink
remove babel && update npm
Browse files Browse the repository at this point in the history
  • Loading branch information
zce committed Apr 24, 2016
1 parent e61dd4c commit 7ffffdb
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 91 deletions.
1 change: 0 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"presets": ["es2015"]
}
1)
90 changes: 26 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,42 @@
# Micua Home

## Install
- npm i babel-core babel-preset-es2015 browser-sync del gulp gulp-autoprefixer gulp-cache gulp-cssnano gulp-eslint gulp-gh-pages gulp-htmlmin gulp-if gulp-imagemin gulp-load-plugins gulp-plumber gulp-reversion gulp-sass gulp-size gulp-sourcemaps gulp-uglify gulp-useref main-bower-files wiredep --save-dev

# Micua Home(a webapp template)

[![Build Status](https://secure.travis-ci.org/Micua/Home.svg?branch=master)](http://travis-ci.org/Micua/Home)

- npm i browser-sync del gulp gulp-autoprefixer gulp-cache gulp-cssnano gulp-eslint gulp-gh-pages gulp-htmlmin gulp-if gulp-imagemin gulp-load-plugins gulp-plumber gulp-reversion gulp-sass gulp-size gulp-sourcemaps gulp-uglify gulp-useref main-bower-files wiredep --save-dev
## Features

Please see our [gulpfile](app/templates/gulpfile.babel.js) for up to date information on what we support.

* CSS Autoprefixing
* Built-in preview server with BrowserSync
* Automagically compile Sass with [libsass](http://libsass.org)
* Automagically lint your scripts
* Map compiled CSS to source stylesheets with source maps
* Awesome image optimization
* Automagically wire-up dependencies installed with [Bower](http://bower.io)
* The gulpfile makes use of [ES2015 features](https://babeljs.io/docs/learn-es2015/) by using [Babel](https://babeljs.io)

var fs = require('fs');
var path = require('path');
var crypto = require('crypto');
var Buffer = require('buffer').Buffer;
var gutil = require('gulp-util');
var PluginError = gutil.PluginError;
var map = require('event-stream').map;
*For more information on what this generator can do for you, take a look at the [gulp plugins](app/templates/_package.json) used in our `package.json`.*

var FILE_DECL = /(href=|src=|url\()(['|"])([^\s>"'.]+?(\.css|\.js|\.png|\.gif|\.jpeg|\.jpg))(['|"])/gi;

var revPlugin = function revPlugin() {
## libsass

return map(function(file, cb) {
Keep in mind that libsass is feature-wise not fully compatible with Ruby Sass. Check out [this](http://sass-compatibility.github.io) curated list of incompatibilities to find out which features are missing.

var contents;
var lines;
var i, length;
var line;
var groups;
var dependencyPath;
var data, hash;
If your favorite feature is missing and you really need Ruby Sass, you can always switch to [gulp-ruby-sass](https://github.com/sindresorhus/gulp-ruby-sass) and update the `styles` task in gulpfile accordingly.

if (!file) {
throw new PluginError('gulp-rev-append', 'Missing file option for gulp-rev-append.');
}

if (!file.contents) {
throw new PluginError('gulp-rev-append', 'Missing file.contents required for modifying files using gulp-rev-append.');
}
## Getting Started

contents = file.contents.toString();
lines = contents.split('\n');
length = lines.length;
- Run `gulp serve` to preview and watch for changes
- Run `bower install --save <package>` to install frontend dependencies
- Run `gulp serve:test` to run the tests in the browser
- Run `gulp` to build your webapp for production
- Run `gulp serve:dist` to preview the production build

for (i = 0; i < length; i++) {
line = lines[i];
groups = FILE_DECL.exec(line);
if (groups && groups.length > 1) {
// are we an "absoulte path"? (e.g. /js/app.js)
var normPath = path.normalize(groups[3]);
if (normPath.indexOf(path.sep) === 0) {
dependencyPath = path.join(file.base, normPath);
} else {
dependencyPath = path.resolve(path.dirname(file.path), normPath);
}

try {
data = fs.readFileSync(dependencyPath);
hash = crypto.createHash('md5');
hash.update(data.toString(), 'utf8');
line = line.replace(groups[4], groups[4] + '?v=' + hash.digest('hex'));
console.log(line);
} catch (e) {
// fail silently.
console.log(e);
}
}
lines[i] = line;
FILE_DECL.lastIndex = 0;
}
file.contents = new Buffer(lines.join('\n'));
cb(null, file);
## License

});

};

module.exports = revPlugin;
ISC © [iceStone](https://github.com/Micua/)

## Install
- npm i babel-core babel-preset-es2015 browser-sync del gulp gulp-autoprefixer gulp-cache gulp-cssnano gulp-eslint gulp-gh-pages gulp-htmlmin gulp-if gulp-imagemin gulp-load-plugins gulp-plumber gulp-reversion gulp-sass gulp-size gulp-sourcemaps gulp-uglify gulp-useref main-bower-files wiredep --save-dev
30 changes: 14 additions & 16 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

const gulp = require("gulp");
const gulpLoadPlugins = require("gulp-load-plugins");
const browserSync = require("browser-sync");
const del = require("del");

const bs = require("browser-sync").create();
const wiredep = require("wiredep").stream;

const plugins = gulpLoadPlugins();
const reload = browserSync.reload;

gulp.task('styles', () => {
return gulp.src('src/styles/*.scss')
Expand All @@ -24,26 +24,24 @@ gulp.task('styles', () => {
precision: 10,
// includePaths: ['']
}).on('error', plugins.sass.logError))
.pipe(plugins.autoprefixer({
browsers: ['last 2 version']
}))
.pipe(plugins.sourcemaps.write())
// .pipe(plugins.autoprefixer({
// browsers: ['last 2 version']
// }))
.pipe(plugins.sourcemaps.write('.'))
.pipe(gulp.dest('temp/styles'))
.pipe(reload({
stream: true
}));
.pipe(bs.stream({ match: "**/*.css" }));
});

function lint(files, options) {
return () => {
return gulp.src(files)
.pipe(reload({
.pipe(bs.reload({
stream: true,
once: true
}))
.pipe(plugins.eslint(options))
.pipe(plugins.eslint.format())
.pipe(plugins.if(!browserSync.active, plugins.eslint.failAfterError()));
.pipe(plugins.if(!bs.active, plugins.eslint.failAfterError()));
};
}
const testLintOptions = {
Expand Down Expand Up @@ -122,7 +120,7 @@ gulp.task('extras', () => {
gulp.task('clean', del.bind(null, ['temp', 'dist', '.publish']));

gulp.task('serve', ['styles', 'fonts'], () => {
browserSync({
bs.init({
notify: false,
port: 2015,
server: {
Expand All @@ -138,15 +136,15 @@ gulp.task('serve', ['styles', 'fonts'], () => {
'src/scripts/**/*.js',
'src/images/**/*',
'temp/fonts/**/*'
]).on('change', reload);
]).on('change', bs.reload);

gulp.watch('src/styles/**/*.scss', ['styles']);
gulp.watch('src/fonts/**/*', ['fonts']);
gulp.watch('bower.json', ['wiredep', 'fonts']);
});

gulp.task('serve:dist', () => {
browserSync({
bs.init({
notify: false,
port: 2015,
server: {
Expand All @@ -156,7 +154,7 @@ gulp.task('serve:dist', () => {
});

gulp.task('serve:test', () => {
browserSync({
bs.init({
notify: false,
port: 2015,
ui: false,
Expand All @@ -168,7 +166,7 @@ gulp.task('serve:test', () => {
}
});

gulp.watch('test/spec/**/*.js').on('change', reload);
gulp.watch('test/spec/**/*.js').on('change', bs.reload);
gulp.watch('test/spec/**/*.js', ['lint:test']);
});

Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
"node": ">=0.12.0"
},
"scripts": {
"watch": "browser-sync start --server --no-notify --files='*.html, scripts/*.js, styles/*.css'"
"watch": "browser-sync start --server --no-notify --files=\"*.html, scripts/*.js, styles/*.css\""
},
"devDependencies": {
"browser-sync": "^2.11.1",
"browser-sync": "^2.12.3",
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-cache": "^0.4.2",
"gulp-cssnano": "^2.1.1",
"gulp-cache": "^0.4.4",
"gulp-cssnano": "^2.1.2",
"gulp-eslint": "^2.0.0",
"gulp-gh-pages": "^0.5.4",
"gulp-htmlmin": "^1.3.0",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^2.4.0",
"gulp-load-plugins": "^1.2.0",
"gulp-load-plugins": "^1.2.2",
"gulp-plumber": "^1.1.0",
"gulp-reversion": "^1.0.1",
"gulp-sass": "^2.2.0",
"gulp-size": "^2.0.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-sass": "^2.3.1",
"gulp-size": "^2.1.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"gulp-uglify": "^1.5.3",
"gulp-useref": "^3.0.7",
"gulp-useref": "^3.0.8",
"main-bower-files": "^2.11.1",
"wiredep": "^3.0.0"
"wiredep": "^4.0.0"
},
"eslintConfig": {
"env": {
Expand Down

0 comments on commit 7ffffdb

Please sign in to comment.