slim-loader
v0.0.9
Published
webpack loader for slim => html => js
Downloads
6
Readme
slim-lang-loader
This is a webpack loader to transform slim 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.
howto
Make sure the
slim
gem is installed and there is aslimrb
executable available.Install this into your project:
npm install --save slim-lang-loader
Add hook to
webpack.config.js
(make sure to put this above any loader that expects javascript or coffeescript input):{test: /\.slim$/, loader: ['slim-lang-loader']},
Also, add
.slim
to the list of extensions:resolve: { extensions: ['.js", <etc>, ".slim"] },
load templates from javascript:
var file = require("html-loader!./test.slim"); alert(file); // this will be a html string that auto-reloads