Authored by shijian

save

... ... @@ -96,7 +96,7 @@ fabric.properties
### NetBeans ###
nbproject/private/
build/
public/build/bundle
nbbuild/
dist/
nbdist/
... ...
{
"name": "yohoblk-wap",
"version": "2.0.5",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
"type": "git",
"url": "http://git.yoho.cn/fe/yohoblk-wap.git"
},
"scripts": {
"start": "node app.js",
"dev": "nodemon -e js,hbs -i public/ app.js",
"build": "cd public && gulp ge",
"online": "NODE_ENV=\"production\" node app.js",
"debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
"lint-js": "eslint -c .eslintrc --cache --fix .",
"lint-css": "stylelint --syntax scss --config .stylelintrc public/scss/**/*.css",
"lint-vue": "eslint -c .eslintrc --cache --fix public/vue/**/*.vue || stylelint --syntax scss --extract --config .stylelintrc public/vue/**/*.vue",
"precommit": "node lint.js"
},
"license": "MIT",
"dependencies": {
"bluebird": "^3.4.2",
"body-parser": "^1.15.2",
"connect-memcached": "^0.2.0",
"connect-multiparty": "^2.0.0",
"cookie-parser": "^1.4.3",
"express": "^4.14.0",
"express-session": "^1.14.1",
"influxdb-winston": "^1.0.1",
"lodash": "^4.15.0",
"memcached": "^2.2.1",
"moment": "^2.14.1",
"morgan": "^1.7.0",
"oneapm": "^1.2.20",
"request-promise": "^3.0.0",
"serve-favicon": "^2.3.0",
"uuid": "^2.0.2",
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.3.0",
"yoho-md5": "^2.0.0",
"vue": "1.0.26",
"babel-runtime": "^6.11.6",
"yoho-node-lib": "0.2.17"
},
"devDependencies": {
"css-loader": "^0.23.0",
"autoprefixer": "^6.4.0",
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-preset-es2015": "^6.14.0",
"eslint": "^3.3.1",
"eslint-config-yoho": "^1.0.1",
"eslint-plugin-html": "^1.5.2",
"extract-text-webpack-plugin": "^1.0.1",
"fastclick": "^1.0.6",
"gulp": "^3.9.1",
"gulp-cssnano": "^2.1.2",
"gulp-ftp": "^1.1.0",
"gulp-postcss": "^6.1.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"gulp-util": "^3.0.7",
"handlebars-loader": "^1.3.0",
"husky": "^0.11.6",
"jquery": "2.2.4",
"nodemon": "^1.10.2",
"postcss-assets": "^4.0.1",
"postcss-cachebuster": "^0.1.3",
"postcss-calc": "^5.3.1",
"postcss-center": "^1.0.0",
"postcss-clearfix": "^1.0.0",
"postcss-crip": "^2.0.0",
"postcss-position": "^0.5.0",
"postcss-pxtorem": "^3.3.1",
"postcss-scss": "^0.1.9",
"postcss-short": "^1.4.0",
"postcss-sprites": "^3.3.0",
"postcss-use": "^2.2.0",
"precss": "^1.4.0",
"shelljs": "^0.7.3",
"style-loader": "^0.13.1",
"stylelint": "^7.1.0",
"stylelint-config-yoho": "^1.2.7",
"stylelint-processor-html": "^1.0.0",
"vue-infinite-scroll": "0.2.3",
"vue-lazyload": "^0.7.0",
"vue-hot-reload-api": "^1.2.0",
"vue-html-loader": "^1.0.0",
"vue-loader": "^8.3.0",
"vue-style-loader": "^1.0.0",
"vue-swipe": "0.2.6",
"vue-touch": "1.1.0",
"webpack": "^1.13.2",
"webpack-dashboard": "^0.1.8",
"webpack-dev-server": "^1.15.0",
"webpack-stream": "^3.1.0",
"yoho-cookie": "1.2.0",
"yoho-qs": "1.0.1",
"yoho-store": "^1.3.20"
}
}
"name": "yohoblk-wap",
"version": "2.0.5",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
"type": "git",
"url": "http://git.yoho.cn/fe/yohoblk-wap.git"
},
"scripts": {
"start": "node app.js",
"dev": "nodemon -e js,hbs -i public/ app.js",
"static": "webpack-dev-server --config ./public/build/webpack.dev.config.js",
"build": "cd public && gulp ge",
"online": "NODE_ENV=\"production\" node app.js",
"debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
"lint-js": "eslint -c .eslintrc --cache --fix .",
"lint-css": "stylelint --syntax scss --config .stylelintrc public/scss/**/*.css",
"lint-vue": "eslint -c .eslintrc --cache --fix public/vue/**/*.vue || stylelint --syntax scss --extract --config .stylelintrc public/vue/**/*.vue",
"precommit": "node lint.js"
},
"license": "MIT",
"dependencies": {
"bluebird": "^3.4.2",
"body-parser": "^1.15.2",
"connect-memcached": "^0.2.0",
"connect-multiparty": "^2.0.0",
"cookie-parser": "^1.4.3",
"express": "^4.14.0",
"express-session": "^1.14.1",
"influxdb-winston": "^1.0.1",
"lodash": "^4.15.0",
"memcached": "^2.2.1",
"moment": "^2.14.1",
"morgan": "^1.7.0",
"oneapm": "^1.2.20",
"request-promise": "^3.0.0",
"serve-favicon": "^2.3.0",
"uuid": "^2.0.2",
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.3.0",
"yoho-md5": "^2.0.0",
"vue": "1.0.26",
"babel-runtime": "^6.11.6",
"yoho-node-lib": "0.2.17"
},
"devDependencies": {
"css-loader": "^0.28.1",
"autoprefixer": "^7.0.1",
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-preset-env": "^1.4.0",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-preset-es2015": "^6.14.0",
"copy-webpack-plugin": "^4.0.1",
"eslint": "^3.3.1",
"eslint-config-yoho": "^1.0.1",
"eslint-plugin-html": "^1.5.2",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "^0.11.1",
"fastclick": "^1.0.6",
"node-sass": "^4.5.2",
"gulp": "^3.9.1",
"gulp-cssnano": "^2.1.2",
"gulp-ftp": "^1.1.0",
"gulp-postcss": "^6.1.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"gulp-util": "^3.0.7",
"handlebars-loader": "^1.3.0",
"husky": "^0.11.6",
"jquery": "2.2.4",
"nodemon": "^1.10.2",
"postcss-assets": "^4.1.0",
"postcss-cachebuster": "^0.1.3",
"postcss-calc": "^5.3.1",
"postcss-center": "^1.0.0",
"postcss-clearfix": "^1.0.0",
"postcss-crip": "^2.0.0",
"postcss-position": "^0.5.0",
"postcss-pxtorem": "^3.3.1",
"postcss-scss": "^1.0.0",
"postcss-short": "^1.4.0",
"postcss-sprites": "^4.2.1",
"postcss-use": "^2.2.0",
"postcss-loader": "^2.0.5",
"precss": "^1.4.0",
"shelljs": "^0.7.3",
"style-loader": "^0.17.0",
"stylelint": "^7.1.0",
"stylelint-config-yoho": "^1.2.7",
"stylelint-processor-html": "^1.0.0",
"vue-infinite-scroll": "0.2.3",
"vue-lazyload": "^0.7.0",
"vue-hot-reload-api": "^1.2.0",
"vue-html-loader": "^1.0.0",
"vue-loader": "^12.0.4",
"vue-template-compiler": "^2.3.3",
"vue-style-loader": "^1.0.0",
"vue-swipe": "0.2.6",
"vue-touch": "1.1.0",
"webpack": "^2.5.1",
"webpack-merge": "^4.1.0",
"webpack-dashboard": "^0.1.8",
"webpack-dev-server": "^2.4.5",
"webpack-stream": "^3.1.0",
"yoho-cookie": "1.2.0",
"yoho-qs": "1.0.1",
"yoho-store": "^1.3.20"
}
}
\ No newline at end of file
... ...
let scss = require('postcss-scss');
let path = require('path');
let assets;
if (process.env.NODE_ENV === 'dev') {
assets = {
loadPaths: [path.join(__dirname, './public/img/')],
basePath: 'static/',
baseUrl: '/img/'
};
}
module.exports = {
parser: scss,
plugins: {
'postcss-assets': assets || {
loadPaths: [path.join(__dirname, './public/img/')],
basePath: 'static/',
baseUrl: '/img/'
},
'postcss-sprites': {
spritePath: './public/static/img/', // 雪碧图生成图片存放地址
stylesheetPath: path.resolve(__dirname, './public/static/'), // 生成后的css中url地址
basePath: './public/img/', // 生成前的查找地址
filterBy: function(image) {
if (!/sprite\//.test(image.url)) {
return Promise.reject();
}
return Promise.resolve();
},
groupBy: function(image) {
let query = image.originalUrl.match(/\/([^\/]*)\/([^\.\/]*).[^\.]*$/);
return Promise.resolve(query[1] + '.' + query[2]);
}
},
precss: {},
autoprefixer: {},
}
};
\ No newline at end of file
... ...
const fs = require('fs');
const path = require('path');
const info = {
host: '127.0.0.1',
port: 5004,
publicPath: 'http://127.0.0.1:5004/'
};
try {
let dev = JSON.parse(fs.readFileSync(path.join(__dirname, '../../.devhost')));
info.host = dev.host;
info.publicPath = `http://${info.host}:${info.port}/`;
} catch (e) {
if (!process.env.NODE_ENV) {
console.error(e);
console.warn(`
推荐在项目主目录建一个 .devhost 文件,内容为
{
"host": "127.0.0.1"
}
`);
}
}
module.exports = info;
... ...
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const shelljs = require('shelljs');
module.exports = {
entry: {
main: './public/js/test.js',
common: './public/js/b.js'
},
output: {
filename: '[name].js',
chunkFilename: '[name].js',
path: path.resolve(__dirname, './public/static/'),
publicPath: '/public/static/'
},
module: {
rules: [{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: ExtractTextPlugin.extract({
use: [ // 'css-loader',
// {
// loader: 'css-loader',
// options: { url: false, root: '../img/' }
// },
{ loader: 'postcss-loader' }
],
fallback: 'vue-style-loader'
})
}
}
}, {
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader'
}
}, {
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'vue-style-loader',
use: [ // 'css-loader',
// { loader: 'css-loader', options: { url: false, root: '../img/' } },
'postcss-loader'
]
})
}, {
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: ['file-loader?name=img/[hash].[ext]']
}]
},
plugins: [
new ExtractTextPlugin('[name].css'),
new webpack.optimize.CommonsChunkPlugin({
// name: 'common'
names: ['common', 'manifest']
}),
new CopyWebpackPlugin([{ from: 'public/img', to: 'img' }], {
ignore: [
'sprite/**'
],
copyUnmodified: true
})
],
resolve: {
alias: {
vue: 'vue/dist/vue.js'
},
extensions: ['.js', '.json', '.scss', '.css', 'vue'],
modules: ['public', 'public/vue', 'public/js', 'public/css', 'node_modules'],
}
};
... ...
const merge = require('webpack-merge');
const webpack = require('webpack');
const path = require('path');
const devInfo = require('./dev-info.js');
module.exports = merge(require('./webpack.config.base'), {
output: {
publicPath: devInfo.publicPath
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
devServer: {
contentBase: path.join(__dirname, 'public/bundle/'),
compress: true,
port: devInfo.port,
host: devInfo.host,
hot: true,
headers: {
'Access-Control-Allow-Origin': '*'
}
},
devtool: 'cheap-eval-source-map'
});
... ...