1.1.2 • Published 6 years ago

egg-view-nunjucks-require v1.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

egg-view-nunjucks-require

NPM version build status Test coverage David deps Known Vulnerabilities npm download

安装

npm i egg-view-nunjucks-require --save

使用场景

如nunjucks模版如下

<html>
  <body>
    {% require 'assets/index.js' %}
  </body>
</html>

本地开发将输出如下:

<html>
  <body>
    <script type="text/javascript" src="/assets_index.js"></script>
  </body>
</html>

正式线上将输出如下:

<html>
  <body>
    <script type="text/javascript" src="http://xxx.demo.com/assets_index-hash.js"></script>
  </body>
</html>

搭配 egg-staticlocal 使用提升研发效率

依赖的插件

开启插件

// config/plugin.js
exports.nunjucksRequire = {
  enable: true,
  package: 'egg-view-nunjucks-require',
};

详细配置

请到 config/config.default.js 查看详细配置项说明。

提问交流

请到 egg-view-nunjucks-require issues 异步交流。

License

MIT

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago