forked from xCss/Valine
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dotos
committed
Aug 4, 2017
1 parent
26f200c
commit 6f381ec
Showing
12 changed files
with
148 additions
and
197 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,45 @@ | ||
{ | ||
"name": "Valine", | ||
"version": "1.0.0", | ||
"description": "A simple comment system based on Leancloud.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "rimraf dist && webpack --watch", | ||
"dev": "node webpack.dev.server.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/xcss/Valine.git" | ||
}, | ||
"keywords": [ | ||
"Comment", | ||
"Valine" | ||
], | ||
"author": "xCss", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/xcss/Valine/issues" | ||
}, | ||
"homepage": "https://github.com/xcss/Valine#readme", | ||
"dependencies": { | ||
"rimraf": "^2.6.1", | ||
"webpack": "^3.4.1", | ||
"webpack-dev-server": "^2.6.1" | ||
} | ||
{ | ||
"name": "Valine", | ||
"version": "1.0.0", | ||
"description": "A simple comment system based on Leancloud.", | ||
"main": "/src/Valine.js", | ||
"scripts": { | ||
"test": "webpack", | ||
"build": "webpack", | ||
"dev": "node_modules/.bin/webpack-dev-server --colors --hot --inline --host 0.0.0.0", | ||
"clear": "rimraf dist " | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/xcss/Valine.git" | ||
}, | ||
"keywords": [ | ||
"Comment", | ||
"Valine" | ||
], | ||
"author": "xCss", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/xcss/Valine/issues" | ||
}, | ||
"homepage": "https://github.com/xcss/Valine#readme", | ||
"devDependencies": { | ||
"autoprefixer": "^7.1.1", | ||
"babel-core": "^6.22.1", | ||
"babel-loader": "^7.0.0", | ||
"babel-preset-es2015": "^6.22.0", | ||
"css-loader": "^0.28.4", | ||
"exports-loader": "^0.6.3", | ||
"file-loader": "^0.11.2", | ||
"node-sass": "^4.5.0", | ||
"postcss-loader": "^2.0.5", | ||
"sass-loader": "^6.0.3", | ||
"style-loader": "^0.18.2", | ||
"url-loader": "^0.5.7", | ||
"webpack": "^2.6.1", | ||
"webpack-dev-server": "^2.4.5" | ||
}, | ||
"dependencies": { | ||
"leancloud-storage": "^3.0.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
plugins: [ | ||
require('autoprefixer') | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class Valine { | ||
/** | ||
* Valine constructor function | ||
* @param {Object} opts | ||
* @constructor | ||
*/ | ||
constructor(opts, AV) { | ||
// let avScript = document.createElement('script'); | ||
// avScript.src = '//cdn1.lncld.net/static/js/3.0.4/av-min.js'; | ||
// let s = document.getElementsByTagName("script")[0]; | ||
// s.parentNode.insertBefore(avScript, s); | ||
if (AV && AV.version) { | ||
this._av = AV; | ||
this._av.init({ | ||
appId: opts.app_id, | ||
appKey: opts.app_key | ||
}) | ||
} | ||
} | ||
} | ||
|
||
module.exports = Valine; |
Empty file.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,66 @@ | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
module.exports = { | ||
// 入口文件 | ||
entry: [ | ||
'./src/js/index.js', | ||
'webpack/hot/dev-server', // 调用热重载hot | ||
'webpack-dev-server/client?http://localhost:8080' // 添加webpack-dev-server客户端 | ||
], | ||
output: { | ||
path: path.join(__dirname, 'dist'), // 指定打包后的目录 | ||
publicPath: 'dist', // 指定资源文件引用的目录 | ||
filename: 'bundle.js' // 指定打包为一个文件 bundle.js | ||
}, | ||
plugins: [ | ||
// 全局开启热代码替换 | ||
new webpack.HotModuleReplacementPlugin() | ||
] | ||
} | ||
var webpack = require('webpack'); | ||
var path = require('path'); | ||
var autoprefixer = require('autoprefixer'); | ||
|
||
var libraryName = 'Valine'; | ||
var env = process.env.WEBPACK_ENV; | ||
var ROOT_PATH = path.resolve(__dirname); | ||
var APP_PATH = path.resolve(ROOT_PATH, 'src'); | ||
var BUILD_PATH = path.resolve(ROOT_PATH, 'dist'); | ||
|
||
var plugins = []; | ||
if (env !== 'dev') { | ||
plugins.push( | ||
new webpack.optimize.UglifyJsPlugin({ | ||
sourceMap: true | ||
}) | ||
); | ||
} | ||
|
||
module.exports = { | ||
entry: './src/' + libraryName + '.js', | ||
|
||
output: { | ||
path: BUILD_PATH, | ||
filename: libraryName + '.min.js', | ||
library: libraryName, | ||
libraryTarget: 'umd', | ||
umdNamedDefine: true | ||
}, | ||
|
||
devtool: 'source-map', | ||
|
||
devServer: { | ||
publicPath: "/dist/", | ||
inline: true, | ||
port: 8088 | ||
}, | ||
|
||
module: { | ||
rules: [{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
include: APP_PATH, | ||
options: { | ||
presets: ['es2015'] | ||
} | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
use: [ | ||
'style-loader', | ||
'css-loader', | ||
'postcss-loader', | ||
'sass-loader' | ||
], | ||
include: APP_PATH | ||
}, | ||
{ | ||
test: /\.(png|jpg)$/, | ||
loader: 'url-loader?limit=40000' | ||
} | ||
] | ||
}, | ||
|
||
plugins: plugins | ||
}; |
Oops, something went wrong.