An open API service indexing awesome lists of open source software.

https://github.com/y8n/inline-template-loader

a webpack loader to inline template as string
https://github.com/y8n/inline-template-loader

inline-templates loader template webpack

Last synced: 4 months ago
JSON representation

a webpack loader to inline template as string

Awesome Lists containing this project

README

          

# inline-template-loader

## Install

```
npm install inline-template-loader
```

## Usage

```javascript
// webpack.conf.js

module: {
rules:[{
test: /\.js$/,
loader: 'inline-template-loader'
}]
}

```

## Output

```javascript
// index.js
function foo(){
return __inline('./template.html');
}
```

```html
// template.html


HelloWorld



```

```javascript
// output.js
function foo(){
return '

HelloWorld

';
}
```

## options

```javascript
// webpack.conf.js

module: {
rules:[{
test: /\.js$/,
loader: 'inline-template-loader',
options: {
pattern: /__template(/ // 正则
replcement: function(m){ // 替换方法
return m.slice(1);
}
}
}]
}

```

## License

MIT