Update webpack and slide resource loading to reduce pack size

This commit is contained in:
Wu Cheng-Han 2016-11-29 00:44:29 +08:00
parent 47d5efb29e
commit c59b4cb883
2 changed files with 6 additions and 2 deletions

View File

@ -93,7 +93,6 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.3.0/js/reveal.min.js" integrity="sha256-lvaInSKflJWLPqf5N5oHr/UZFwXKD6gckerdwoHqECY=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.3.0/js/reveal.min.js" integrity="sha256-lvaInSKflJWLPqf5N5oHr/UZFwXKD6gckerdwoHqECY=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.3.1/velocity.min.js" integrity="sha256-zt0EvRuKYSkXKgIFLrJIYeZsBjIZLel9UThCm5GI6io=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.3.1/velocity.min.js" integrity="sha256-zt0EvRuKYSkXKgIFLrJIYeZsBjIZLel9UThCm5GI6io=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js" integrity="sha256-jnOjDTXIPqall8M0MyTSt98JetJuZ7Yu+1Jm7hLTF7U=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js" integrity="sha256-jnOjDTXIPqall8M0MyTSt98JetJuZ7Yu+1Jm7hLTF7U=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.6.1/js-yaml.min.js" integrity="sha256-tvANaUGcQTLkCS9wHnLZhBFVfIWQJpm98WOpykjD+eo=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.6.1/js-yaml.min.js" integrity="sha256-tvANaUGcQTLkCS9wHnLZhBFVfIWQJpm98WOpykjD+eo=" crossorigin="anonymous" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js" integrity="sha256-yYfngbEKv4RENfGDvNUqJTqGFcKf31NJEe9OTnnMH3Y=" crossorigin="anonymous" defer></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js" integrity="sha256-yYfngbEKv4RENfGDvNUqJTqGFcKf31NJEe9OTnnMH3Y=" crossorigin="anonymous" defer></script>

View File

@ -116,7 +116,7 @@ module.exports = {
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
chunks: ['common', 'slide-pack'], chunks: ['slide-pack'],
filename: path.join(__dirname, 'public/views/build/slide-pack-scripts.ejs'), filename: path.join(__dirname, 'public/views/build/slide-pack-scripts.ejs'),
inject: false inject: false
}), }),
@ -283,6 +283,7 @@ module.exports = {
path.join(__dirname, 'public/js/pretty.js') path.join(__dirname, 'public/js/pretty.js')
], ],
slide: [ slide: [
"bootstrap-tooltip",
"expose?filterXSS!xss", "expose?filterXSS!xss",
"flowchart.js", "flowchart.js",
"js-sequence-diagrams", "js-sequence-diagrams",
@ -301,6 +302,10 @@ module.exports = {
path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.css') path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.css')
], ],
"slide-pack": [ "slide-pack": [
"expose?jQuery!expose?$!jquery",
"velocity-animate",
"imports?$=jquery!jquery-mousewheel",
"bootstrap-tooltip",
"expose?jsyaml!js-yaml", "expose?jsyaml!js-yaml",
"script!mermaid", "script!mermaid",
"expose?moment!moment", "expose?moment!moment",