Skip to content

Instantly share code, notes, and snippets.

@nucab
Created May 5, 2016 09:40
Show Gist options
  • Save nucab/0b0a354a5280c4c4e9f2f09d66bb71af to your computer and use it in GitHub Desktop.
Save nucab/0b0a354a5280c4c4e9f2f09d66bb71af to your computer and use it in GitHub Desktop.
var fs = require('fs');
var uglify = require('uglify-js').minify;
var pkg = require('./package');
fs.writeFileSync('dist/flexibility.js', [
'/*! Flexibility ',
pkg.version,
' | ',
pkg.license,
' Licensed | github.com/',
pkg.repository,
' */\n',
'(function () {',
[
'lib/core.js',
'lib/vendor/array-prototype-for-each.js',
'lib/vendor/css-layout.js',
'lib/vendor/event-listener.js',
'lib/detect.js',
'lib/init.js',
'lib/on-resize.js',
'lib/update-flex-container-cache.js',
'lib/update-flex-item-cache.js',
'lib/update-length-cache.js',
'lib/walk.js'
].map(function (file) {
return fs.readFileSync(file, 'utf8');
}).join(''),
'})()'
].join(''), 'utf8');
fs.writeFileSync('dist/flexibility.min.js', uglify([
'/*! Flexibility ',
pkg.version,
' | ',
pkg.license,
' Licensed | github.com/',
pkg.repository,
' */\n',
'(function () {',
[
'lib/core.js',
'lib/vendor/array-prototype-for-each.js',
'lib/vendor/css-layout.js',
'lib/vendor/event-listener.js',
'lib/detect.js',
'lib/init.js',
'lib/on-resize.js',
'lib/update-flex-container-cache.js',
'lib/update-flex-item-cache.js',
'lib/update-length-cache.js',
'lib/walk.js'
].map(function (file) {
return fs.readFileSync(file, 'utf8');
}).join(''),
'})()'
].join(''), {
fromString: true
}).code, 'utf8');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment