Authored by xuqi

wap layout

@@ -14,9 +14,19 @@ @@ -14,9 +14,19 @@
14 <link rel="dns-prefetch" href="//static.yohobuy.com"> 14 <link rel="dns-prefetch" href="//static.yohobuy.com">
15 <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> 15 <link rel="dns-prefetch" href="//img12.static.yhbimg.com">
16 <link rel="dns-prefetch" href="//img13.static.yhbimg.com"> 16 <link rel="dns-prefetch" href="//img13.static.yhbimg.com">
  17 + {{#if devEnv}}
  18 + <link rel="stylesheet" href="//localhost:3000/css/index.css">
  19 + {{^}}
  20 + <link rel="stylesheet" href="//cdn.yoho.cn/mYohobuy/{{version}}/index.css">
  21 + {{/if}}
17 </head> 22 </head>
18 <body> 23 <body>
19 {{> header}} 24 {{> header}}
20 {{{body}}} 25 {{{body}}}
  26 + {{#if devEnv}}
  27 + <script src="//localhost:8000/{{module}}.{{page}}.js"></script>
  28 + {{^}}
  29 + <script src="//cdn.yoho.cn/{{module}}.{{page}}.js"></script>
  30 + {{/if}}
21 </body> 31 </body>
22 </html> 32 </html>
No preview for this file type
@@ -105,6 +105,9 @@ const postcssPlugin = (et) => { @@ -105,6 +105,9 @@ const postcssPlugin = (et) => {
105 return plugins; 105 return plugins;
106 }; 106 };
107 107
  108 +// default
  109 +gulp.task('default', ['postcss-dev', 'postcss-watch', 'webpack-dev-server']);
  110 +
108 // postcss compile in dev 111 // postcss compile in dev
109 gulp.task('postcss-dev', () => { 112 gulp.task('postcss-dev', () => {
110 return gulp.src('scss/index.css') 113 return gulp.src('scss/index.css')
@@ -143,25 +146,25 @@ gulp.task('postcss', ['assets'], () => { @@ -143,25 +146,25 @@ gulp.task('postcss', ['assets'], () => {
143 }); 146 });
144 147
145 // webpack dev server 148 // webpack dev server
146 -// gulp.task('webpack-dev-server', () => {  
147 -// var devConfig = Object.assign({}, webpackConfig, {  
148 -// devtool: 'eval',  
149 -// debug: true  
150 -// });  
151 -  
152 -// new webpackDevServer(webpack(devConfig), {  
153 -// contentBase: '.',  
154 -// publicPath: '/',  
155 -// stats: {  
156 -// colors: true  
157 -// }  
158 -// }).listen(8000, 'localhost', (err) => {  
159 -// if (err) {  
160 -// throw new gutil.PluginError('webpack-dev-server', err);  
161 -// }  
162 -// gutil.log('[webpack-serve]', 'http://localhost:8000/');  
163 -// });  
164 -// }); 149 +gulp.task('webpack-dev-server', () => {
  150 + var devConfig = Object.assign({}, webpackConfig, {
  151 + debug: true
  152 + });
  153 +
  154 + new webpackDevServer(webpack(devConfig), {
  155 + contentBase: '.',
  156 + publicPath: '//localhost:8000/',
  157 + hot: true,
  158 + stats: {
  159 + colors: true
  160 + }
  161 + }).listen(8000, 'localhost', (err) => {
  162 + if (err) {
  163 + throw new gutil.PluginError('webpack-dev-server', err);
  164 + }
  165 + gutil.log('[webpack-serve]', 'http://localhost:8000/');
  166 + });
  167 +});
165 168
166 // webpack compile in pro 169 // webpack compile in pro
167 gulp.task('webpack', () => { 170 gulp.task('webpack', () => {
@@ -27,7 +27,7 @@ ls(__dirname + '/js/**/*.page.js').forEach((f) => { @@ -27,7 +27,7 @@ ls(__dirname + '/js/**/*.page.js').forEach((f) => {
27 module.exports = { 27 module.exports = {
28 entry: entries, 28 entry: entries,
29 output: { 29 output: {
30 - path: './bundle', 30 + path: path.join(__dirname, 'bundle'), //absolute path
31 filename: '[name].js' 31 filename: '[name].js'
32 } 32 }
33 }; 33 };