Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
shijian
2017-05-23 14:53:08 +0800
Commit
ebc85f410bd9d7f04761892a45adb12deb190bfb
1 parent
178cf2c2
save
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
215 additions
and
165 deletions
package.json
postcss.config.js
public/build/dev-info.js
public/build/webpack.config.base.js → public/build/webpack.base.config.js
public/build/webpack.config.dev.js → public/build/webpack.dev.config.js
package.json
View file @
ebc85f4
{
"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
"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"
:
{
"babel-runtime"
:
"^6.11.6"
,
"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"
,
"handlebars-loader"
:
"^1.5.0"
,
"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"
,
"postcss-import"
:
"^10.0.0"
,
"request-promise"
:
"^3.0.0"
,
"serve-favicon"
:
"^2.3.0"
,
"uuid"
:
"^2.0.2"
,
"vue"
:
"1.0.26"
,
"vue-loader"
:
"^8.3.0"
,
"vue-template-compiler"
:
"^2.3.3"
,
"winston"
:
"^2.2.0"
,
"winston-daily-rotate-file"
:
"^1.3.0"
,
"yoho-md5"
:
"^2.0.0"
,
"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"
}
}
...
...
postcss.config.js
View file @
ebc85f4
let
scss
=
require
(
'postcss-scss'
);
let
path
=
require
(
'path'
);
const
devInfo
=
require
(
'./public/build/dev-info.js'
);
let
assets
;
let
assets
,
sprites
;
if
(
process
.
env
.
NODE_ENV
===
'dev'
)
{
assets
=
{
loadPaths
:
[
path
.
join
(
__dirname
,
'./public/img/'
)],
basePath
:
'static/'
,
baseUrl
:
'/img/'
basePath
:
devInfo
.
publicPath
,
baseUrl
:
'public/'
};
sprites
=
{
basePath
:
'./public/img/'
,
// 生成前的查找地址
spritePath
:
'./public/build/bundle'
,
// 雪碧图生成图片存放地址
stylesheetPath
:
'./public/build/bundle'
,
// 生成后的css中url地址
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
]);
}
};
}
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
(
/
\/([^\/]
*
)\/([^\.\/]
*
)
.
[^\.]
*$/
);
'postcss-import'
:
{
path
:
[
path
.
join
(
__dirname
,
'./public/scss'
)],
resolve
(
id
)
{
let
name
=
path
.
basename
(
id
);
return
Promise
.
resolve
(
query
[
1
]
+
'.'
+
query
[
2
]);
if
(
!
/^_/
.
test
(
name
))
{
id
=
path
.
dirname
(
id
)
+
'/_'
+
name
;
}
return
id
;
}
},
'postcss-assets'
:
assets
,
'postcss-sprites'
:
sprites
,
precss
:
{},
autoprefixer
:
{},
'postcss-pxtorem'
:
{
rootValue
:
40
,
unitPrecision
:
5
,
// 保留5位小数字
minPixelValue
:
2
,
// 小于 2 时,不转换
selectorBlackList
:
[],
// 选择器黑名单,可以使用正则
propWhiteList
:
[]
// 属性名称为空,表示替换所有属性的值
},
autoprefixer
:
{
browsers
:
[
'> 1%'
,
'android >=4'
,
'ios >=8'
]
}
}
};
\ No newline at end of file
};
...
...
public/build/dev-info.js
View file @
ebc85f4
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
;
module
.
exports
=
info
;
\ No newline at end of file
...
...
public/build/webpack.
config.base
.js → public/build/webpack.
base.config
.js
View file @
ebc85f4
...
...
@@ -3,17 +3,47 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
const
webpack
=
require
(
'webpack'
);
const
CopyWebpackPlugin
=
require
(
'copy-webpack-plugin'
);
const
shelljs
=
require
(
'shelljs'
);
const
_
=
require
(
'lodash'
);
const
getEntries
=
()
=>
{
const
entries
=
{
libs
:
[
'babel-polyfill'
,
'yoho-jquery'
,
'yoho-qs'
,
'yoho-cookie'
,
'yoho-store'
,
'jquery'
,
'vue'
,
'vue-lazyload'
,
'vue-swipe'
,
'vue-infinite-scroll'
,
'vue-touch'
,
'fastclick'
,
path
.
join
(
__dirname
,
'../js/global.js'
),
path
.
join
(
__dirname
,
'../js/index.js'
)
],
index
:
path
.
join
(
__dirname
,
'../scss/index.css'
)
};
// 老的生成规则module.page.js
shelljs
.
ls
(
path
.
join
(
__dirname
,
'../js/**/*.page.js'
)).
forEach
((
f
)
=>
{
const
dir
=
_
.
slice
(
f
.
split
(
'/'
),
-
2
);
// [modulename, xx.page.js]
// Important
// 生成规则:module.page: './js/module/xx.page.js'
entries
[
`
$
{
dir
[
0
]}.
$
{
dir
[
1
].
match
(
/
(
.*
)
.page.js/
)[
1
]}
`
]
=
path
.
join
(
__dirname
,
`
..
/
js
/
$
{
dir
.
join
(
'/'
)}
`
);
});
return
entries
;
};
module
.
exports
=
{
entry
:
{
main
:
'./public/js/test.js'
,
common
:
'./public/js/b.js'
},
entry
:
getEntries
(),
output
:
{
filename
:
'[name].js'
,
chunkFilename
:
'[name].js'
,
path
:
path
.
resolve
(
__dirname
,
'./public/static/'
),
publicPath
:
'/public/static/'
path
:
path
.
resolve
(
__dirname
,
'bundle'
)
},
module
:
{
rules
:
[{
...
...
@@ -22,7 +52,7 @@ module.exports = {
options
:
{
loaders
:
{
scss
:
ExtractTextPlugin
.
extract
({
use
:
[
// 'css-loader',
use
:
[
// {
// loader: 'css-loader',
// options: { url: false, root: '../img/' }
...
...
@@ -43,7 +73,7 @@ module.exports = {
test
:
/
\.
css$/
,
use
:
ExtractTextPlugin
.
extract
({
fallback
:
'vue-style-loader'
,
use
:
[
// 'css-loader',
use
:
[
// { loader: 'css-loader', options: { url: false, root: '../img/' } },
'postcss-loader'
]
...
...
@@ -51,13 +81,25 @@ module.exports = {
},
{
test
:
/
\.(
png|jpe
?
g|gif|svg
)(\?
.*
)?
$/
,
use
:
[
'file-loader?name=img/[hash].[ext]'
]
},
{
test
:
/
\.
hbs$/
,
use
:
[{
loader
:
'handlebars-loader'
,
options
:
{
helperDirs
:
[
path
.
join
(
__dirname
,
'../js/common/helpers'
)
],
partialDirs
:
[
path
.
join
(
__dirname
,
'../../doraemon/views/partial'
)
]
}
}]
}]
},
plugins
:
[
new
ExtractTextPlugin
(
'[name].css'
),
new
webpack
.
optimize
.
CommonsChunkPlugin
({
// name: 'common'
names
:
[
'common'
,
'manifest'
]
names
:
[
'libs'
,
'manifest'
]
}),
new
CopyWebpackPlugin
([{
from
:
'public/img'
,
to
:
'img'
}],
{
ignore
:
[
...
...
@@ -71,6 +113,12 @@ module.exports = {
vue
:
'vue/dist/vue.js'
},
extensions
:
[
'.js'
,
'.json'
,
'.scss'
,
'.css'
,
'vue'
],
modules
:
[
'public'
,
'public/vue'
,
'public/js'
,
'public/css'
,
'node_modules'
],
modules
:
[
path
.
join
(
__dirname
,
'../../node_modules'
),
path
.
join
(
__dirname
,
'../vue'
),
path
.
join
(
__dirname
,
'../hbs'
),
path
.
join
(
__dirname
,
'../scss'
),
path
.
join
(
__dirname
,
'../js'
),
],
}
};
...
...
public/build/webpack.
config.dev
.js → public/build/webpack.
dev.config
.js
View file @
ebc85f4
...
...
@@ -4,7 +4,7 @@ const path = require('path');
const
devInfo
=
require
(
'./dev-info.js'
);
module
.
exports
=
merge
(
require
(
'./webpack.
config.base
'
),
{
module
.
exports
=
merge
(
require
(
'./webpack.
base.config
'
),
{
output
:
{
publicPath
:
devInfo
.
publicPath
},
...
...
Please
register
or
login
to post a comment