Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxpleaner/slim-lang-loader
Webpack loader: slim => html => javascript
https://github.com/maxpleaner/slim-lang-loader
webpack webpack-loader
Last synced: about 2 months ago
JSON representation
Webpack loader: slim => html => javascript
- Host: GitHub
- URL: https://github.com/maxpleaner/slim-lang-loader
- Owner: MaxPleaner
- License: mit
- Created: 2017-03-07T23:36:30.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-27T20:16:59.000Z (about 5 years ago)
- Last Synced: 2024-11-14T15:49:23.695Z (2 months ago)
- Topics: webpack, webpack-loader
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 19
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slim-lang-loader
This is a webpack loader to transform [slim](http://slimlang.org) files
into HTML, and then load that HTML into Javascript. This is "true blue"
slim, using the ruby program's CLI executable.The resulting HTML does not have any boiler added - it can be full
HTML documents or just partials / fragments.The code here is a modified version of
[coffee-loader](https://github.com/webpack-contrib/coffee-loader).## howto
1. Make sure the `slim` gem is installed and there is a `slimrb`
executable available.2. Install this into your project: `npm install --save slim-lang-loader` (or `yarn add -D slim-lang-loader`)
3. Add hook to `webpack.config.js` (_make sure to put this above any loader
that expects javascript or coffeescript input_):```js
{test: /\.slim$/, loader: ['slim-lang-loader']},
```Also, add `.slim` to the list of extensions:
```jsP
resolve: {
extensions: ['.js", , ".slim"]
},
```4. load templates from javascript:
```js
var file = require("html-loader!./test.slim");
alert(file); // this will be a html string that auto-reloads
```## slim options
You can pass [Slim options](http://www.rubydoc.info/gems/slim/frames#Configuring_Slim) to slimrb using following syntax:
```js
loader: [
{
loader: 'slim-lang-loader',
options: {
slimOptions: {
'disable_escape': true
}
}
}
]
```