diff options
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | public/js/index.js | 5 | ||||
-rw-r--r-- | public/js/public.js | 4 | ||||
-rw-r--r-- | public/views/foot.ejs | 2 | ||||
-rw-r--r-- | public/views/index.ejs | 3 | ||||
-rw-r--r-- | public/views/pretty.ejs | 2 | ||||
-rw-r--r-- | public/views/slide.ejs | 2 | ||||
-rw-r--r-- | webpack.config.js | 16 |
8 files changed, 20 insertions, 16 deletions
diff --git a/package.json b/package.json index 52f646e6..ea83c7af 100644 --- a/package.json +++ b/package.json @@ -120,6 +120,8 @@ "babel-loader": "^6.2.5", "bower-webpack-plugin": "^0.1.9", "css-loader": "^0.25.0", + "exports-loader": "^0.6.3", + "expose-loader": "^0.7.1", "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.9.0", "imports-loader": "^0.6.5", diff --git a/public/js/index.js b/public/js/index.js index bac2c9d0..0c6bb03a 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -5,14 +5,9 @@ require('jquery-ui/ui/widgets/controlgroup'); require('jquery-ui/ui/widgets/autocomplete'); /* jquery and jquery plugins */ -require('jquery'); -require('jquery-textcomplete'); -require('jquery-mousewheel'); -require('jquery-scrollspy/jquery-scrollspy'); require('../vendor/showup/showup'); /* bootstrap */ -require('bootstrap'); require('bootstrap/dist/css/bootstrap.css'); require('prismjs/themes/prism.css'); diff --git a/public/js/public.js b/public/js/public.js index 858de389..b6d4f7a0 100644 --- a/public/js/public.js +++ b/public/js/public.js @@ -5,10 +5,6 @@ require('jquery-ui/ui/widgets/controlgroup'); require('jquery-ui/ui/widgets/autocomplete'); /* jquery and jquery plugins */ -require('jquery'); -require('jquery-textcomplete'); -require('jquery-mousewheel'); -require('jquery-scrollspy/jquery-scrollspy'); require('../vendor/showup/showup'); /* bootstrap */ diff --git a/public/views/foot.ejs b/public/views/foot.ejs index 150214f4..9ce320bc 100644 --- a/public/views/foot.ejs +++ b/public/views/foot.ejs @@ -23,7 +23,7 @@ <% } %> <script src="<%- url %>/vendor/Idle.Js/build/idle.min.js" defer></script> <script src="<%- url %>/vendor/lz-string/libs/lz-string.min.js" defer></script> -<script src="<%- url %>/vendor/jquery/dist/jquery.min.js" defer></script> +<script src="<%- url %>/build/vendor.bundle.js" defer></script> <!--codemirror--> <script src="<%- url %>/vendor/codemirror/codemirror.min.js" defer></script> <script src="<%- url %>/vendor/inlineAttachment/inline-attachment.js" defer></script> diff --git a/public/views/index.ejs b/public/views/index.ejs index 04a401a4..79ee5ddc 100644 --- a/public/views/index.ejs +++ b/public/views/index.ejs @@ -193,9 +193,8 @@ <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment-with-locales.min.js" defer></script> <script src="//cdnjs.cloudflare.com/ajax/libs/js-url/2.3.0/url.min.js" defer></script> <% } else { %> - <script src="<%- url %>/vendor/jquery/dist/jquery.min.js" defer></script> + <script src="<%- url %>/build/vendor.bundle.js" defer></script> <script src="<%- url %>/vendor/velocity/velocity.min.js" defer></script> - <script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script> <script src="<%- url %>/vendor/select2/select2.min.js" defer></script> <script src="<%- url %>/vendor/moment/min/moment-with-locales.min.js" defer></script> <script src="<%- url %>/vendor/js-url/url.min.js" defer></script> diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs index 6b1096bb..346cb272 100644 --- a/public/views/pretty.ejs +++ b/public/views/pretty.ejs @@ -90,7 +90,7 @@ <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment-with-locales.min.js" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/6.0.0/mermaid.min.js" defer></script> <% } else { %> -<script src="<%- url %>/vendor/jquery/dist/jquery.min.js"></script> +<script src="<%- url %>/build/vendor.bundle.js" defer></script> <script src="<%- url %>/vendor/js-yaml/dist/js-yaml.min.js" defer></script> <script type="text/javascript" src="<%- url %>/vendor/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script> <script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script> diff --git a/public/views/slide.ejs b/public/views/slide.ejs index 1549989f..8c248917 100644 --- a/public/views/slide.ejs +++ b/public/views/slide.ejs @@ -87,7 +87,7 @@ <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment-with-locales.min.js" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/6.0.0/mermaid.min.js" defer></script> <% } else { %> - <script src="<%- url %>/vendor/jquery/dist/jquery.min.js"></script> + <script src="<%- url %>/build/vendor.bundle.js" defer></script> <script src="<%- url %>/vendor/reveal.js/lib/js/head.min.js"></script> <script src="<%- url %>/vendor/reveal.js/js/reveal.js"></script> <script src="<%- url %>/vendor/velocity/velocity.min.js" defer></script> diff --git a/webpack.config.js b/webpack.config.js index 5a7d6718..de2bb8b6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -17,14 +17,26 @@ module.exports = { new webpack.DefinePlugin({ "require.specified": "require.resolve" }), - new ExtractTextPlugin("[name].css") + new ExtractTextPlugin("[name].css"), + new webpack.optimize.CommonsChunkPlugin({ + name: "vendor", + filename: "vendor.bundle.js", + minChunks: Infinity, + }) ], entry: { index: path.join(__dirname, 'public/js/index.js'), public: path.join(__dirname, 'public/js/public.js'), slide: path.join(__dirname, 'public/js/slide.js'), - locale: path.join(__dirname, 'public/js/locale.js') + locale: path.join(__dirname, 'public/js/locale.js'), + vendor: [ + "expose?$!expose?jQuery!jquery", + "jquery-textcomplete", + "jquery-mousewheel", + "jquery-scrollspy/jquery-scrollspy", + "bootstrap" + ] }, output: { |