@x_x_x/webpack-assets-versions-plugin
v1.0.0
Published
build versions of static files
Readme
@my/webpack-assets-versions-plugin
Install
Create file .npmrc with content:
registry=http://npm.my.cloud.devmail.ruInstall npm
$ npm install @my/webpack-assets-versions-plugin --save-devUsage
Include plugin in webpack.config.js
const { AssetsVersionsPlugin } = require('@my/webpack-assets-versions-plugin');
...
plugins: [
...
new AssetsVersionsPlugin(),
...
],
...Include scripts and styles in hbs template
{{#if isTestServer}}
<link rel="stylesheet" type="text/css" href="{{hosts.staticCss}}app.css"/>
<script type="text/javascript" src="{{hosts.staticJs}}vendor.js"></script>
<script type="text/javascript" src="{{hosts.staticJs}}app.js"></script>
{{else}}
<link rel="stylesheet" type="text/css" href="{{hosts.static}}{{cssVersions.app}}"/>
<script type="text/javascript" src="{{hosts.static}}{{jsVersions.vendor}}"></script>
<script type="text/javascript" src="{{hosts.static}}{{jsVersions.app}}"></script>
{{/if}}Add vars to mydawnfe
in src/app.ts (method readCfg):
pathToJsVersions: onlineconf.get('/PATH_ONLINECONF_CONFIG/path-to-js-versions'),
pathToCssVersions: onlineconf.get('/PATH_ONLINECONF_CONFIG/path-to-css-versions')in src/lib/Page.ts (method getTemplateVars):
Object.assign(vars, {
jsVersions: this.app.JS_VERSIONS;
cssVersions: this.app.CSS_VERSIONS;
});And put value of path-to-js-versions and path-to-css-versions to onlineconf.
