内置 html-webpack-plugin #53

Closed
pigcan opened this Issue Jan 20, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@pigcan
Member

pigcan commented Jan 20, 2016

html 文件做为开发时的必要内容,把这个插件集成进来吧

https://www.npmjs.com/package/html-webpack-plugin

@zinkey

This comment has been minimized.

Show comment
Hide comment
@zinkey

zinkey Jan 20, 2016

Member

现在项目基本都是有自己的 html 作为调试文件,部署后就不用这个文件。另外,现在 html 文件里面不仅是加载 js,css 文件,还有一些自定义配置,比如:

<script>
global.config = {
  host:'',
  user:{}
};
</script>

所以,要是需要就采用直接配置 webpack.config.js 的方式。

Member

zinkey commented Jan 20, 2016

现在项目基本都是有自己的 html 作为调试文件,部署后就不用这个文件。另外,现在 html 文件里面不仅是加载 js,css 文件,还有一些自定义配置,比如:

<script>
global.config = {
  host:'',
  user:{}
};
</script>

所以,要是需要就采用直接配置 webpack.config.js 的方式。

@sorrycc

This comment has been minimized.

Show comment
Hide comment
@sorrycc

sorrycc Jan 20, 2016

Member

离线包需要,内置进来吧。使用的时候在 js 里 require('./a.html');

Member

sorrycc commented Jan 20, 2016

离线包需要,内置进来吧。使用的时候在 js 里 require('./a.html');

@sorrycc

This comment has been minimized.

Show comment
Hide comment
@sorrycc

sorrycc Jan 20, 2016

Member
- a.html
- a.js
- a.css

支持 html 之后,build 之后的 dist 下的文件就直接可用了。deploy 之类的操作会方便一些。

Member

sorrycc commented Jan 20, 2016

- a.html
- a.js
- a.css

支持 html 之后,build 之后的 dist 下的文件就直接可用了。deploy 之类的操作会方便一些。

@sorrycc sorrycc referenced this issue Jan 27, 2016

Closed

0.6.0 需求收集 #61

11 of 11 tasks complete
@sorrycc

This comment has been minimized.

Show comment
Hide comment
@sorrycc

sorrycc Jan 27, 2016

Member

参考代码:

  var htmlLoader = [
    'file-loader?name=[path][name].[ext]',
    'template-html-loader?' + [
      'raw=true',
      'engine=lodash',
      'version=' + pkg.version,
      'title=' + pkg.name,
      'debug=' + DEBUG
    ].join('&')
  ].join('!');

  {
    test: /\.html$/,
    loader: htmlLoader,
  }
Member

sorrycc commented Jan 27, 2016

参考代码:

  var htmlLoader = [
    'file-loader?name=[path][name].[ext]',
    'template-html-loader?' + [
      'raw=true',
      'engine=lodash',
      'version=' + pkg.version,
      'title=' + pkg.name,
      'debug=' + DEBUG
    ].join('&')
  ].join('!');

  {
    test: /\.html$/,
    loader: htmlLoader,
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment