Commit cb6c036d authored by Mike Greiling's avatar Mike Greiling

create a common.js bundle and include all jQuery plugins

parent e80fa698
...@@ -6,23 +6,8 @@ ...@@ -6,23 +6,8 @@
/* global AwardsHandler */ /* global AwardsHandler */
/* global Aside */ /* global Aside */
window.$ = window.jQuery = require('jquery'); // common libraries
require('jquery-ujs');
require('vendor/jquery.endless-scroll');
require('vendor/jquery.waitforimages');
require('vendor/jquery.caret');
require('vendor/jquery.atwho');
require('vendor/jquery.scrollTo');
window.Cookies = require('js-cookie'); window.Cookies = require('js-cookie');
require('./autosave');
require('bootstrap/js/affix');
require('bootstrap/js/alert');
require('bootstrap/js/dropdown');
require('bootstrap/js/modal');
require('bootstrap/js/tab');
require('bootstrap/js/transition');
require('bootstrap/js/tooltip');
require('select2/select2.js');
window.Pikaday = require('pikaday'); window.Pikaday = require('pikaday');
window._ = require('underscore'); window._ = require('underscore');
window.Dropzone = require('dropzone'); window.Dropzone = require('dropzone');
...@@ -34,7 +19,6 @@ require('./shortcuts_navigation'); ...@@ -34,7 +19,6 @@ require('./shortcuts_navigation');
require('./shortcuts_dashboard_navigation'); require('./shortcuts_dashboard_navigation');
require('./shortcuts_issuable'); require('./shortcuts_issuable');
require('./shortcuts_network'); require('./shortcuts_network');
require('vendor/jquery.nicescroll');
// behaviors // behaviors
require('./behaviors/autosize'); require('./behaviors/autosize');
......
require('./jquery');
// twitter bootstrap plugins
require('bootstrap-sass/assets/javascripts/bootstrap/affix');
require('bootstrap-sass/assets/javascripts/bootstrap/alert');
require('bootstrap-sass/assets/javascripts/bootstrap/dropdown');
require('bootstrap-sass/assets/javascripts/bootstrap/modal');
require('bootstrap-sass/assets/javascripts/bootstrap/tab');
require('bootstrap-sass/assets/javascripts/bootstrap/transition');
require('bootstrap-sass/assets/javascripts/bootstrap/tooltip');
require('./jquery');
require('./bootstrap');
// jQuery library
window.$ = window.jQuery = require('jquery');
// jQuery plugins
require('jquery-ujs');
require('vendor/jquery.endless-scroll');
require('vendor/jquery.caret');
require('vendor/jquery.atwho');
require('vendor/jquery.scrollTo');
require('vendor/jquery.nicescroll');
require('vendor/jquery.waitforimages');
require('select2/select2.js');
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
= stylesheet_link_tag "application", media: "all" = stylesheet_link_tag "application", media: "all"
= stylesheet_link_tag "print", media: "print" = stylesheet_link_tag "print", media: "print"
= javascript_include_tag(*webpack_asset_paths("common"))
= javascript_include_tag(*webpack_asset_paths("application")) = javascript_include_tag(*webpack_asset_paths("application"))
- if content_for?(:page_specific_javascripts) - if content_for?(:page_specific_javascripts)
......
...@@ -17,6 +17,7 @@ var WEBPACK_REPORT = process.env.WEBPACK_REPORT; ...@@ -17,6 +17,7 @@ var WEBPACK_REPORT = process.env.WEBPACK_REPORT;
var config = { var config = {
context: path.join(ROOT_PATH, 'app/assets/javascripts'), context: path.join(ROOT_PATH, 'app/assets/javascripts'),
entry: { entry: {
common: './commons/index.js',
application: './application.js', application: './application.js',
blob_edit: './blob_edit/blob_edit_bundle.js', blob_edit: './blob_edit/blob_edit_bundle.js',
boards: './boards/boards_bundle.js', boards: './boards/boards_bundle.js',
...@@ -90,13 +91,18 @@ var config = { ...@@ -90,13 +91,18 @@ var config = {
IS_PRODUCTION ? IS_PRODUCTION ?
new webpack.HashedModuleIdsPlugin() : new webpack.HashedModuleIdsPlugin() :
new webpack.NamedModulesPlugin(), new webpack.NamedModulesPlugin(),
// create a common.js bundle to be loaded on every page
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
minChunks: Infinity,
}),
], ],
resolve: { resolve: {
extensions: ['.js', '.es6', '.js.es6'], extensions: ['.js', '.es6', '.js.es6'],
alias: { alias: {
'~': path.join(ROOT_PATH, 'app/assets/javascripts'), '~': path.join(ROOT_PATH, 'app/assets/javascripts'),
'bootstrap/js': 'bootstrap-sass/assets/javascripts/bootstrap',
'emoji-aliases$': path.join(ROOT_PATH, 'fixtures/emojis/aliases.json'), 'emoji-aliases$': path.join(ROOT_PATH, 'fixtures/emojis/aliases.json'),
'icons': path.join(ROOT_PATH, 'app/views/shared/icons'), 'icons': path.join(ROOT_PATH, 'app/views/shared/icons'),
'vendor': path.join(ROOT_PATH, 'vendor/assets/javascripts'), 'vendor': path.join(ROOT_PATH, 'vendor/assets/javascripts'),
......
...@@ -5,23 +5,12 @@ jasmine.getFixtures().fixturesPath = 'base/spec/javascripts/fixtures'; ...@@ -5,23 +5,12 @@ jasmine.getFixtures().fixturesPath = 'base/spec/javascripts/fixtures';
jasmine.getJSONFixtures().fixturesPath = 'base/spec/javascripts/fixtures'; jasmine.getJSONFixtures().fixturesPath = 'base/spec/javascripts/fixtures';
// include common libraries // include common libraries
require('~/commons/index.js');
window.$ = window.jQuery = require('jquery'); window.$ = window.jQuery = require('jquery');
window._ = require('underscore'); window._ = require('underscore');
window.Cookies = require('js-cookie'); window.Cookies = require('js-cookie');
window.Vue = require('vue'); window.Vue = require('vue');
window.Vue.use(require('vue-resource')); window.Vue.use(require('vue-resource'));
require('jquery-ujs');
require('bootstrap/js/affix');
require('bootstrap/js/alert');
require('bootstrap/js/button');
require('bootstrap/js/collapse');
require('bootstrap/js/dropdown');
require('bootstrap/js/modal');
require('bootstrap/js/scrollspy');
require('bootstrap/js/tab');
require('bootstrap/js/transition');
require('bootstrap/js/tooltip');
require('bootstrap/js/popover');
// stub expected globals // stub expected globals
window.gl = window.gl || {}; window.gl = window.gl || {};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment