-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{ | ||
"presets": ["es2015"] | ||
} | ||
1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
||
[](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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters