Commit ec918071 authored by Mike Greiling's avatar Mike Greiling

create a cacheable commons bundle for d3 library

parent 1f974331
/* eslint-disable func-names, space-before-function-paren */
window.d3 = require('d3');
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, camelcase, vars-on-top, object-shorthand, comma-dangle, eqeqeq, no-mixed-operators, no-return-assign, newline-per-chained-call, prefer-arrow-callback, consistent-return, one-var, one-var-declaration-per-line, prefer-template, quotes, no-unused-vars, no-else-return, max-len */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, camelcase, vars-on-top, object-shorthand, comma-dangle, eqeqeq, no-mixed-operators, no-return-assign, newline-per-chained-call, prefer-arrow-callback, consistent-return, one-var, one-var-declaration-per-line, prefer-template, quotes, no-unused-vars, no-else-return, max-len */
/* global d3 */
import d3 from 'd3';
(function() { (function() {
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }; var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
......
- @no_container = true - @no_container = true
- page_title "Charts" - page_title "Charts"
- content_for :page_specific_javascripts do - content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('common_d3')
= page_specific_javascript_bundle_tag('graphs') = page_specific_javascript_bundle_tag('graphs')
= render "projects/commits/head" = render "projects/commits/head"
......
- @no_container = true - @no_container = true
- page_title "Contributors" - page_title "Contributors"
- content_for :page_specific_javascripts do - content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('common_d3')
= page_specific_javascript_bundle_tag('graphs') = page_specific_javascript_bundle_tag('graphs')
= render 'projects/commits/head' = render 'projects/commits/head'
......
- @no_container = true - @no_container = true
- page_title "Charts", "Pipelines" - page_title "Charts", "Pipelines"
- content_for :page_specific_javascripts do - content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('common_d3')
= page_specific_javascript_bundle_tag('graphs') = page_specific_javascript_bundle_tag('graphs')
= render 'head' = render 'head'
......
- page_title @user.name - page_title @user.name
- page_description @user.bio - page_description @user.bio
- content_for :page_specific_javascripts do - content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('lib_d3') = page_specific_javascript_bundle_tag('common_d3')
= page_specific_javascript_bundle_tag('users') = page_specific_javascript_bundle_tag('users')
- header_title @user.name, user_path(@user) - header_title @user.name, user_path(@user)
- @no_container = true - @no_container = true
......
...@@ -19,6 +19,7 @@ var config = { ...@@ -19,6 +19,7 @@ var config = {
entry: { entry: {
common: './commons/index.js', common: './commons/index.js',
common_vue: ['vue', 'vue-resource'], common_vue: ['vue', 'vue-resource'],
common_d3: ['d3'],
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',
...@@ -40,7 +41,6 @@ var config = { ...@@ -40,7 +41,6 @@ var config = {
snippet: './snippet/snippet_bundle.js', snippet: './snippet/snippet_bundle.js',
terminal: './terminal/terminal_bundle.js', terminal: './terminal/terminal_bundle.js',
users: './users/users_bundle.js', users: './users/users_bundle.js',
lib_d3: './lib/d3.js',
vue_pipelines: './vue_pipelines_index/index.js', vue_pipelines: './vue_pipelines_index/index.js',
}, },
...@@ -116,6 +116,12 @@ var config = { ...@@ -116,6 +116,12 @@ var config = {
}, },
}), }),
// create cacheable common library bundle for all d3 chunks
new webpack.optimize.CommonsChunkPlugin({
name: 'common_d3',
chunks: ['graphs', 'users'],
}),
// create cacheable common library bundles // create cacheable common library bundles
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
names: ['application', 'common', 'manifest'], names: ['application', 'common', 'manifest'],
......
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