打包方式调整
This commit is contained in:
@@ -0,0 +1 @@
|
||||
<%- css('css/main.f4509ed5.css') %> <%- css('css/extra.5bcda5b2.css') %>
|
||||
@@ -29,8 +29,7 @@
|
||||
<% if (theme.favicon){ %>
|
||||
<link rel="icon" href="<%- theme.favicon %>">
|
||||
<% } %>
|
||||
<%- css('css/main.css') %>
|
||||
<%- css('css/extra.css') %>
|
||||
<%- partial('css') %>
|
||||
<style type="text/css">
|
||||
#container.show {
|
||||
background: <%= theme.style && theme.style.slider ? theme.style.slider : 'linear-gradient(200deg,#a0cfe4,#e8c37e)' %>;
|
||||
|
||||
@@ -1 +1 @@
|
||||
<%- js('js/mobile.20f43113c8272156b4bc.js') %> <%- js('js/slider.04cd5097b8512828a2aa.js') %> <%- js('js/comment.3c5be78a9577afb4fddf.js') %> <%- js('js/main.bc3ad605ba4123d612db.js') %> <%- js('js/waifu.9d85c4a11fee47ec966e.js') %>
|
||||
<%- js('js/mobile.a60bf6c0.js') %> <%- js('js/slider.eb328173.js') %> <%- js('js/comment.005a3d19.js') %> <%- js('js/main.89388b6e.js') %> <%- js('js/waifu.be6b2520.js') %>
|
||||
@@ -185,7 +185,7 @@ const waifuTools = {
|
||||
"tools.chart"() {
|
||||
// 一言
|
||||
axios.get('https://api.imjad.cn/hitokoto/?cat=&charset=utf-8&length=55&encode=json').then(res => {
|
||||
this.showMessage(`${res.data.hitokoto} --${res.data.source}`)
|
||||
this.showMessage(res.data.hitokoto + res.data.source?` ——${res.data.source}`:'')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,18 @@ import '../lib/live2d'
|
||||
// 浏览器判断
|
||||
import Browser from './browser'
|
||||
const isMobile = (Browser.versions.mobile && window.screen.width < 800)
|
||||
// 加载live2d模型
|
||||
if(!isMobile) {
|
||||
|
||||
/**
|
||||
* 判断浏览器是否支持WebGL
|
||||
*/
|
||||
function isSupportWebGL() {
|
||||
var canvas = document.createElement("canvas");
|
||||
var webGL = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
||||
return webGL && webGL instanceof WebGLRenderingContext
|
||||
}
|
||||
|
||||
if(!isMobile && isSupportWebGL()) {
|
||||
// 加载live2d模型
|
||||
loadlive2d('live2d', 'https://blog-cdn.nos-eastchina1.126.net/live2D/Kesshouban/model.json')
|
||||
document.querySelector('.waifu').style.display = 'block'
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<% var left = '<%-' %>
|
||||
<% var right = '%' %>
|
||||
<% var right2 = '>' %>
|
||||
|
||||
<% for (let index in htmlWebpackPlugin.files.css) { %>
|
||||
<% let cssFile = htmlWebpackPlugin.files.css[index] %>
|
||||
<%= `${left} css('${cssFile.substr(cssFile.indexOf("css"),cssFile.length)}') ${right}${right2}` %>
|
||||
<% } %>
|
||||
@@ -3,5 +3,5 @@
|
||||
<% var right2 = '>' %>
|
||||
|
||||
<% for (let chunk in htmlWebpackPlugin.files.chunks) { %>
|
||||
<%= `${left} js('js/${chunk}.${htmlWebpackPlugin.files.chunks[chunk].hash}.js') ${right}${right2}` %>
|
||||
<%= `${left} js('js/${chunk}.${htmlWebpackPlugin.files.chunks[chunk].hash.substr(0,8)}.js') ${right}${right2}` %>
|
||||
<% } %>
|
||||
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +1,3 @@
|
||||
const webpack = require("webpack")
|
||||
const autoprefixer = require('autoprefixer')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const CleanPlugin = require('clean-webpack-plugin')
|
||||
@@ -13,8 +11,8 @@ const minifyHTML = {
|
||||
minifyJS:true
|
||||
}
|
||||
|
||||
const mainCss = new ExtractTextPlugin("css/main.css")
|
||||
const extraCss = new ExtractTextPlugin("css/extra.css")
|
||||
const mainCss = new ExtractTextPlugin("css/main.[contenthash:8].css")
|
||||
const extraCss = new ExtractTextPlugin("css/extra.[contenthash:8].css")
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
@@ -26,16 +24,13 @@ module.exports = {
|
||||
},
|
||||
output: {
|
||||
path: __dirname+"/source",
|
||||
filename: "js/[name].[chunkhash].js"
|
||||
filename: "js/[name].[chunkhash:8].js"
|
||||
},
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader?cacheDirectory',
|
||||
exclude: /node_modules/
|
||||
},{
|
||||
test: /\.html$/,
|
||||
loader: 'html'
|
||||
},{
|
||||
test: /\.(scss|sass)$/,
|
||||
loader: mainCss.extract({fallback:"style-loader",use:["css-loader","postcss-loader","sass-loader?outputStyle=compact"]})
|
||||
@@ -67,10 +62,17 @@ module.exports = {
|
||||
inject: false,
|
||||
cache: false,
|
||||
minify: minifyHTML,
|
||||
template: './source-src/script.ejs',
|
||||
template: './source-src/template/script.html',
|
||||
filename: '../layout/_partial/script.ejs'
|
||||
}),
|
||||
new CleanPlugin(['source/js/*.js'],{
|
||||
new HtmlWebpackPlugin({
|
||||
inject: false,
|
||||
cache: false,
|
||||
minify: minifyHTML,
|
||||
template: './source-src/template/css.html',
|
||||
filename: '../layout/_partial/css.ejs'
|
||||
}),
|
||||
new CleanPlugin(['source/js/*.js','source/css/*.css'],{
|
||||
verbose: true,
|
||||
dry: false,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user