mirror of https://github.com/status-im/codimd.git
Optimize common assets with CDN
* jquery * lodash * socket.io * boostrap
This commit is contained in:
parent
43c9f68b9a
commit
773c0ce39e
|
@ -1,9 +1,6 @@
|
|||
/* jquery and jquery plugins */
|
||||
require('../vendor/showup/showup');
|
||||
|
||||
/* bootstrap */
|
||||
require('bootstrap/dist/css/bootstrap.css');
|
||||
|
||||
require('prismjs/themes/prism.css');
|
||||
require('highlight.js/styles/github-gist.css');
|
||||
|
||||
|
@ -15,6 +12,8 @@ var saveAs = require('file-saver').saveAs;
|
|||
require('js-url');
|
||||
require('randomcolor');
|
||||
|
||||
var _ = require("lodash");
|
||||
|
||||
var List = require('list.js');
|
||||
|
||||
var common = require('./common.js');
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
/* jquery and jquery plugins */
|
||||
require('../vendor/showup/showup');
|
||||
|
||||
/* bootstrap */
|
||||
require('bootstrap/dist/css/bootstrap.css');
|
||||
|
||||
require('prismjs/themes/prism.css');
|
||||
require('highlight.js/styles/github-gist.css');
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
require('bootstrap/js/tooltip');
|
||||
require('bootstrap/dist/css/bootstrap.css');
|
||||
|
||||
require('prismjs/themes/prism.css');
|
||||
|
||||
/* other vendors plugin */
|
||||
|
|
|
@ -3,11 +3,8 @@
|
|||
</script>
|
||||
<% if(useCDN) { %>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/spin.js/2.3.2/spin.min.js" defer></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/velocity/1.3.1/velocity.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js" defer></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.5.0/socket.io.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/js-yaml/3.6.1/js-yaml.min.js" defer></script>
|
||||
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment-with-locales.min.js" defer></script>
|
||||
|
@ -20,6 +17,10 @@
|
|||
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
|
||||
<script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script>
|
||||
<% } %>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.5.0/socket.io.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/viz.js/1.3.0/viz.js" defer></script>
|
||||
<%- include build/index-scripts %>
|
||||
<script src="<%- url %>/js/google-drive-upload.js" defer></script>
|
||||
|
|
|
@ -8,17 +8,16 @@
|
|||
<link rel="icon" type="image/png" href="<%- url %>/favicon.png">
|
||||
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
|
||||
<% if(useCDN) { %>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.9.0/bootstrap-social.min.css">
|
||||
<% } else { %>
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/font-awesome/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/Ionicons/css/ionicons.min.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/octicons/octicons/octicons.css">
|
||||
<link rel="stylesheet" href="<%- url %>/css/bootstrap-social.css">
|
||||
<% } %>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/jquery-ui/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/lib/codemirror.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/codemirror-spell-checker/spell-checker.min.css">
|
||||
|
|
|
@ -195,7 +195,6 @@
|
|||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<% if(useCDN) { %>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" defer></script>
|
||||
<script src="//cdn.jsdelivr.net/velocity/1.3.1/velocity.min.js" defer></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js" defer></script>
|
||||
|
@ -205,6 +204,8 @@
|
|||
<script src="<%- url %>/vendor/velocity/velocity.min.js" defer></script>
|
||||
<script src="<%- url %>/vendor/moment/min/moment-with-locales.min.js" defer></script>
|
||||
<% } %>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.min.js" defer></script>
|
||||
<%- include build/cover-scripts %>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -18,15 +18,14 @@
|
|||
<link rel="icon" type="image/png" href="<%- url %>/favicon.png">
|
||||
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
|
||||
<% if(useCDN) { %>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
|
||||
<% } else { %>
|
||||
<link rel="stylesheet" href='<%- url %>/vendor/font-awesome/css/font-awesome.min.css'>
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/Ionicons/css/ionicons.min.css">
|
||||
<link rel="stylesheet" href="<%- url %>/vendor/octicons/octicons/octicons.css">
|
||||
<% } %>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href='<%- url %>/css/github-extract.css'>
|
||||
<link rel="stylesheet" href='<%- url %>/css/gist.css'>
|
||||
<link rel="stylesheet" href="<%- url %>/css/mermaid.css">
|
||||
|
@ -90,8 +89,6 @@
|
|||
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
|
||||
</script>
|
||||
<% if(useCDN) { %>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.6.1/js-yaml.min.js" defer></script>
|
||||
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment-with-locales.min.js" defer></script>
|
||||
|
@ -102,6 +99,9 @@
|
|||
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
|
||||
<script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script>
|
||||
<% } %>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/viz.js/1.3.0/viz.js" defer></script>
|
||||
<%- include build/pretty-scripts %>
|
||||
<script src="<%- url %>/js/reveal-markdown.js" defer></script>
|
||||
|
|
|
@ -87,7 +87,6 @@
|
|||
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
|
||||
</script>
|
||||
<% if(useCDN) { %>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/velocity/1.3.1/velocity.min.js" defer></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.6.1/js-yaml.min.js" defer></script>
|
||||
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
|
||||
|
@ -102,6 +101,8 @@
|
|||
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
|
||||
<script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script>
|
||||
<% } %>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.min.js" defer></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/viz.js/1.3.0/viz.js" defer></script>
|
||||
<%- include build/slide-scripts %>
|
||||
</body>
|
||||
|
|
|
@ -6,11 +6,13 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|||
module.exports = {
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
'_': 'lodash',
|
||||
Visibility: "visibilityjs",
|
||||
Cookies: "js-cookie",
|
||||
emojify: "emojify.js",
|
||||
key: "keymaster"
|
||||
key: "keymaster",
|
||||
$: "jquery",
|
||||
jQuery: "jquery",
|
||||
"window.jQuery": "jquery"
|
||||
}),
|
||||
new ExtractTextPlugin("[name].css"),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
|
@ -76,7 +78,6 @@ module.exports = {
|
|||
slide: path.join(__dirname, 'public/js/slide.js'),
|
||||
locale: path.join(__dirname, 'public/js/locale.js'),
|
||||
vendor: [
|
||||
"expose?$!expose?jQuery!jquery",
|
||||
"jquery-mousewheel",
|
||||
"jquery-scrollspy/jquery-scrollspy",
|
||||
"jquery-ui/ui/widgets/resizable",
|
||||
|
@ -86,7 +87,6 @@ module.exports = {
|
|||
"script!gist-embed",
|
||||
"expose?filterXSS!xss",
|
||||
"js-url",
|
||||
"bootstrap",
|
||||
"expose?Spinner!spin.js",
|
||||
"script!Idle.Js",
|
||||
"expose?LZString!lz-string",
|
||||
|
@ -127,7 +127,10 @@ module.exports = {
|
|||
},
|
||||
|
||||
externals: {
|
||||
"viz.js": "Viz"
|
||||
"viz.js": "Viz",
|
||||
"socket.io-client": "io",
|
||||
"lodash": "_",
|
||||
"jquery": "$"
|
||||
},
|
||||
|
||||
module: {
|
||||
|
|
Loading…
Reference in New Issue