Try to remove unused front-end dependency

This commit is contained in:
Wu Cheng-Han 2016-10-19 22:14:32 +08:00
parent d70d0318e5
commit 7ebc84bec0
7 changed files with 17 additions and 60 deletions

View file

@ -1,3 +1,5 @@
require('./locale');
var common = require('./common'); var common = require('./common');
var checkIfAuth = common.checkIfAuth; var checkIfAuth = common.checkIfAuth;
var urlpath = common.urlpath; var urlpath = common.urlpath;

View file

@ -1,3 +1,8 @@
require('prismjs/themes/prism.css');
require('highlight.js/styles/github-gist.css');
var Prism = require('prismjs');
require('prismjs/components/prism-wiki');
var hljs = require('highlight.js'); var hljs = require('highlight.js');
var PDFObject = require('pdfobject'); var PDFObject = require('pdfobject');
var S = require('string'); var S = require('string');

View file

@ -1,16 +1,11 @@
/* jquery and jquery plugins */ /* jquery and jquery plugins */
require('../vendor/showup/showup'); require('../vendor/showup/showup');
require('prismjs/themes/prism.css');
require('highlight.js/styles/github-gist.css');
require('prismjs');
require('prismjs/components/prism-wiki');
var toMarkdown = require('to-markdown'); var toMarkdown = require('to-markdown');
var saveAs = require('file-saver').saveAs; var saveAs = require('file-saver').saveAs;
require('js-url'); var url = require('js-url');
require('randomcolor'); var randomColor = require('randomcolor');
var _ = require("lodash"); var _ = require("lodash");
@ -28,7 +23,6 @@ var noteurl = common.noteurl;
var checkLoginStateChanged = common.checkLoginStateChanged; var checkLoginStateChanged = common.checkLoginStateChanged;
require('./pretty');
var extra = require('./extra'); var extra = require('./extra');
var md = extra.md; var md = extra.md;
var updateLastChange = extra.updateLastChange; var updateLastChange = extra.updateLastChange;

View file

@ -1,5 +1,3 @@
require('./cover');
var lang = "en"; var lang = "en";
var userLang = navigator.language || navigator.userLanguage; var userLang = navigator.language || navigator.userLanguage;
var userLangCode = userLang.split('-')[0]; var userLangCode = userLang.split('-')[0];

View file

@ -1,25 +0,0 @@
/* jquery and jquery plugins */
require('../vendor/showup/showup');
require('prismjs/themes/prism.css');
require('highlight.js/styles/github-gist.css');
/* other vendors plugin */
require('string');
require('prismjs');
require('prismjs/components/prism-wiki');
require('to-markdown');
require('file-saver');
require('store');
require('js-url');
require('visibilityjs');
require('list.js');
require('../vendor/md-toc');
require('randomcolor');
require('./extra');
require('./syncscroll');
require('./history');
require('./pretty');
require('./render');

View file

@ -1,30 +1,13 @@
require('prismjs/themes/prism.css');
/* other vendors plugin */ /* other vendors plugin */
var S = require('string'); var S = require('string');
require('prismjs');
require('prismjs/components/prism-wiki');
require('to-markdown');
require('../vendor/md-toc');
require('randomcolor');
var commonModule = require('./common');
var urlpath = commonModule.urlpath;
var noteid = commonModule.noteid;
var debug = commonModule.debug;
var version = commonModule.version;
var GOOGLE_API_KEY = commonModule.GOOGLE_API_KEY;
var GOOGLE_CLIENT_ID = commonModule.GOOGLE_CLIENT_ID;
var DROPBOX_APP_KEY = commonModule.DROPBOX_APP_KEY;
var noteurl = commonModule.noteurl;
var extraModule = require('./extra'); var extraModule = require('./extra');
var md = extraModule.md; var md = extraModule.md;
var updateLastChange = extraModule.updateLastChange; var updateLastChange = extraModule.updateLastChange;
var finishView = extraModule.finishView; var finishView = extraModule.finishView;
require('./render'); var preventXSS = require('./render').preventXSS;
var body = $(".slides").html(); var body = $(".slides").html();
$(".slides").html(S(body).unescapeHTML().s); $(".slides").html(S(body).unescapeHTML().s);

View file

@ -17,7 +17,7 @@ module.exports = {
}), }),
new ExtractTextPlugin("[name].css"), new ExtractTextPlugin("[name].css"),
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
names: ["vendor", "public", "slide", "locale"], names: ["cover", "index", "pretty", "slide", "vendor"],
children: true, children: true,
async: true, async: true,
filename: '[name].js', filename: '[name].js',
@ -37,25 +37,25 @@ module.exports = {
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['vendor', 'locale'], chunks: ['vendor', 'cover'],
filename: path.join(__dirname, 'public/views/build/cover-header.ejs'), filename: path.join(__dirname, 'public/views/build/cover-header.ejs'),
inject: false inject: false
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
chunks: ['vendor', 'locale'], chunks: ['vendor', 'cover'],
filename: path.join(__dirname, 'public/views/build/cover-scripts.ejs'), filename: path.join(__dirname, 'public/views/build/cover-scripts.ejs'),
inject: false inject: false
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/header.ejs', template: 'public/views/includes/header.ejs',
chunks: ['vendor', 'public'], chunks: ['vendor', 'pretty'],
filename: path.join(__dirname, 'public/views/build/pretty-header.ejs'), filename: path.join(__dirname, 'public/views/build/pretty-header.ejs'),
inject: false inject: false
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'public/views/includes/scripts.ejs', template: 'public/views/includes/scripts.ejs',
chunks: ['vendor', 'public'], chunks: ['vendor', 'pretty'],
filename: path.join(__dirname, 'public/views/build/pretty-scripts.ejs'), filename: path.join(__dirname, 'public/views/build/pretty-scripts.ejs'),
inject: false inject: false
}), }),
@ -74,10 +74,10 @@ module.exports = {
], ],
entry: { entry: {
cover: path.join(__dirname, 'public/js/cover.js'),
index: path.join(__dirname, 'public/js/index.js'), index: path.join(__dirname, 'public/js/index.js'),
public: path.join(__dirname, 'public/js/public.js'), pretty: path.join(__dirname, 'public/js/pretty.js'),
slide: path.join(__dirname, 'public/js/slide.js'), slide: path.join(__dirname, 'public/js/slide.js'),
locale: path.join(__dirname, 'public/js/locale.js'),
vendor: [ vendor: [
"imports?$=jquery!jquery-mousewheel", "imports?$=jquery!jquery-mousewheel",
"expose?filterXSS!xss", "expose?filterXSS!xss",