Commit 994161c61064a55732d550fc8313d1934ae0003e

Authored by 商艳涛
1 parent fba98272

no message

src/js/component/datatable.js
  1 +var template = require('../../hbs/datatable.hbs');
1 2  
2   -var template = require('../../hdbs/datatable.hdbs');
3   -
4   -var data = [{fullname:"terry"},{fullname:"jack"}];
  3 +var data = [{ fullname: "terry" }, { fullname: "jack" }];
5 4  
6 5 var htmlcontent = template(data);
7 6  
8   -$('#container').append(htmlcontent).append("数据加载完毕~");
9 7 \ No newline at end of file
  8 +$('#container').append(htmlcontent).append("数据加载完毕~");
... ...
src/js/loaddata.js
1 1 require('../css/loaddata.scss');
2   -var template = require('../hdbs/datatable.hdbs');
  2 +var template = require('../hbs/datatable.hbs');
3 3 require('../js/component/datatable.js');
4 4  
... ...
src/tpl/index.ejs renamed to src/templates/ejs/index.ejs
1 1 <%- require('./component/header.ejs')() %>
2 2  
3   - <h1>Hello,World!</h1>
4   - <h2>Across the Great Wall ,we can reach every corner in the world~</h2>
5   - <img src="img/embed/1.png" />
  3 +<h1>Hello,World!</h1>
  4 +<h2>Across the Great Wall ,we can reach every corner in the world~</h2>
  5 +<img src="img/embed/1.png" />
6 6  
7 7 <%- require('./component/footer.ejs')() %>
8 8 \ No newline at end of file
... ...
src/tpl/loaddata.ejs renamed to src/templates/ejs/news.ejs
src/tpl/component/footer.ejs renamed to src/templates/ejs/partial/footer.ejs
src/tpl/component/header.ejs renamed to src/templates/ejs/partial/header.ejs
src/tpl/component/datatable.ejs deleted 100755 → 0
1   -<ul>
2   - <% for(var i=0; i<supplies.length; i++) {%>
3   - <li><%= supplies[i] %></li>
4   - <% } %>
5   -</ul>
6 0 \ No newline at end of file
webpack.config.js
... ... @@ -108,16 +108,16 @@ var config = {
108 108 extractCSS,
109 109 // 生成单独html页面(仅仅示例,生成多页面写法不同)
110 110 new HtmlWebpackPlugin({
111   - template: path.join(SRC_PATH, 'tpl/') + 'index.ejs',
  111 + template: path.join(SRC_PATH, 'templates/ejs/') + 'index.ejs',
112 112 filename: 'index.html',
113 113 chunks: ['commons', 'index', 'webpack-dev-server'],
114 114 inject: 'body'
115 115 }),
116 116  
117 117 new HtmlWebpackPlugin({
118   - template: path.join(SRC_PATH, 'tpl/') + 'loaddata.ejs',
119   - filename: 'loaddata.html',
120   - chunks: ['commons', 'loaddata', 'webpack-dev-server'],
  118 + template: path.join(SRC_PATH, 'templates/ejs/') + 'news.ejs',
  119 + filename: 'news.html',
  120 + chunks: ['commons', 'news', 'webpack-dev-server'],
121 121 inject: 'body'
122 122 })
123 123 ]
... ...