Skip to content

Commit

Permalink
Merge branch 'SidKwok-master' into rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredreich committed Jul 12, 2017
2 parents f684f18 + 4dd1774 commit 6033a74
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 122 deletions.
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"presets": ["es2015", "stage-0"]
"presets": [
["es2015", {"modules": false}],
"stage-0"
]
}
106 changes: 13 additions & 93 deletions dist/pell.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,8 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["pell"] = factory();
else
root["pell"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
value: true
});
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.pell = {})));
}(this, (function (exports) { 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

Expand Down Expand Up @@ -229,7 +146,7 @@ var actions = {
}
};

var init = exports.init = function init(settings) {
var init = function init(settings) {
settings.actions = settings.actions ? settings.actions.map(function (action) {
if (typeof action === 'string') return actions[action];
return _extends({}, actions[action.name], action);
Expand Down Expand Up @@ -263,8 +180,11 @@ var init = exports.init = function init(settings) {
});
};

exports.default = { init: init };
var pell = { init: init };

exports.init = init;
exports['default'] = pell;

Object.defineProperty(exports, '__esModule', { value: true });

/***/ })
/******/ ]);
});
})));
2 changes: 1 addition & 1 deletion dist/pell.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 28 additions & 23 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,59 @@
const Webpack = require('webpack')
const rollup = require('gulp-rollup')
const babel = require('rollup-plugin-babel')
const uglify = require('rollup-plugin-uglify')
const gulp = require('gulp')
const webpack = require('gulp-webpack')
const cssnano = require('gulp-cssnano')
const rename = require('gulp-rename')
const sass = require('gulp-sass')
const size = require('gulp-size')
const del = require('del')
const run = require('run-sequence')

gulp.task('clean', () => del(['./dist']))

const webpackConfig = minimize => ({
output: {
filename: minimize ? 'pell.min.js' : 'pell.js',
library: 'pell',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader']
}
]
},
plugins: minimize
const rollupConfig = minimize => ({
rollup: require('rollup'),
entry: './src/pell.js',
moduleName: 'pell',
format: 'umd',
exports: 'named',
plugins: [
babel({
exclude: 'node_modules/**'
})
].concat(minimize
? [
new Webpack.optimize.UglifyJsPlugin({
uglify({
compress: { warnings: false },
mangle: true,
sourcemap: false
sourceMap: false
})
]
: []
)
})

gulp.task('script', () => {
gulp.src('./src/pell.js')
.pipe(webpack(webpackConfig(false), Webpack))
gulp.src('./src/*.js')
.pipe(rollup(rollupConfig(false)))
.pipe(size({showFiles: true}))
.pipe(gulp.dest('./dist'))
.pipe(webpack(webpackConfig(true), Webpack))
gulp.src('./src/*.js')
.pipe(rollup(rollupConfig(true)))
.pipe(rename('pell.min.js'))
.pipe(size({showFiles: true}))
.pipe(size({gzip: true, showFiles: true}))
.pipe(gulp.dest('./dist'))
})

gulp.task('style', () => {
gulp.src(['./src/pell.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(size({showFiles: true}))
.pipe(gulp.dest('./dist'))
.pipe(cssnano())
.pipe(rename('pell.min.css'))
.pipe(size({showFiles: true}))
.pipe(gulp.dest('./dist'))
})

Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@
"homepage": "https://jaredreich.com/pell",
"devDependencies": {
"babel-core": "6.23.1",
"babel-loader": "6.3.2",
"babel-preset-es2015": "6.22.0",
"babel-preset-stage-0": "6.22.0",
"del": "2.2.2",
"eslint-config-jared": "1.2.0",
"gulp": "3.9.1",
"gulp-cssnano": "2.1.2",
"gulp-rename": "1.2.2",
"gulp-rollup": "^2.14.0",
"gulp-sass": "3.1.0",
"gulp-webpack": "1.5.0",
"run-sequence": "1.2.2",
"webpack": "2.2.1"
"gulp-size": "^2.1.0",
"rollup": "^0.45.1",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-uglify": "^2.0.1",
"run-sequence": "1.2.2"
}
}

0 comments on commit 6033a74

Please sign in to comment.