Froguard / rgl-tplmin-loader

A loader for regular component template content file, no regularJs parse

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rgl-tplmin-loader

version  GitHub issues  Github licences

  • A webpack loader for regularjs 's component-template file.

  • Neither <script> nor <style> will be resolved or parsed or minified in this loader

  • Just only minify the tpl file's content-text in a simple way, remove redundant code(the special chars like space, enter between tags).

  • no parse, no render. It is different from regular-loader , just string convert

Installation

npm install --save-dev rgl-tplmin-loader

Usage

Use the loader either via your webpack config

Via webpack config (recommended)

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.rgl$/, // or /\.html$/
        use: 'rgl-tplmin-loader'
      }
    ]
  }
}

with happypack

module.exports = {
  module: {
	rules: [
	  {
		test: /\.rgl$/, // or /\.html$/
		use: 'happypack/loader?id=rglmin'
	  }
	]
  }
},
plugins: [
	new HappyPack({
		id: 'rglmin',
		threadPool: happyThreadPool,
		loaders: ['rgl-tplmin-loader?' + JSON.stringify({
			minimize: true,
			comments: {
				html: false,
				rgl: false
			}
		})]
	})
]

In your application

import rgl from 'file.rgl';

CLI

webpack --module-bind 'rgl=rgl-tplmin'

In your application

import rgl from 'file.rgl';

Inline

In your application

import template from 'rgl-tplmin!./file.rgl';

About

A loader for regular component template content file, no regularJs parse

License:MIT License


Languages

Language:JavaScript 100.0%