From: Kevin Ball Date: Tue, 10 Jan 2017 22:50:46 +0000 (-0800) Subject: Very most basic beginnings of using webpack for module bundling X-Git-Tag: v6.4.0-rc1~51^2~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fb617c587f417bbfffa62125cb9e5fb38c9005f;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Very most basic beginnings of using webpack for module bundling --- diff --git a/js/entries/all.js b/js/entries/all.js new file mode 100644 index 000000000..918ca704e --- /dev/null +++ b/js/entries/all.js @@ -0,0 +1 @@ +import Foundation from '../foundation.core'; diff --git a/js/foundation.core.js b/js/foundation.core.js index 3a3fce6ad..db619ccd7 100644 --- a/js/foundation.core.js +++ b/js/foundation.core.js @@ -1,7 +1,6 @@ -!function($) { - "use strict"; +import $ from 'jquery'; var FOUNDATION_VERSION = '6.3.1'; // Global Foundation object @@ -333,4 +332,4 @@ function hyphenate(str) { return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); } -}(jQuery); +export default Foundation; diff --git a/package.json b/package.json index a9f8c78b4..b9005d929 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "array-uniq": "^1.0.2", "autoprefixer": "^6.5.3", "babel-core": "^6.3.26", + "babel-loader": "^6.2.10", "babel-plugin-transform-es2015-arrow-functions": "^6.3.13", "babel-plugin-transform-es2015-block-scoped-functions": "^6.3.13", "babel-plugin-transform-es2015-block-scoping": "^6.4.0", @@ -92,6 +93,7 @@ "touch": "^1.0.0", "vinyl": "^2.0.1", "vinyl-source-stream": "^1.1.0", + "webpack": "^2.2.0-rc.3", "yargs": "^6.5.0" }, "engines": { diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 000000000..b4bc076b6 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,28 @@ +module.exports = { + entry: "./js/entries/all.js", + output: { + path: './_build/assets/js/', + filename: "foundation.js" + }, + externals: { + jquery: 'jQuery' + }, + module: { + loaders: [ + ], + rules: [ + // JS LOADER + // Reference: https://github.com/babel/babel-loader + // Transpile .js files using babel-loader + // Compiles ES6 and ES7 into ES5 code + { + test: /\.js$/, + use: [ + { + loader: 'babel-loader', + } + ], + } + ] + } +};