Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slim-lang-loader

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slim-lang-loader

webpack loader for slim => html => js

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.2K
increased by12.85%
Maintainers
1
Weekly downloads
 
Created
Source

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

  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):

    {test: /\.slim$/, loader: ['slim-lang-loader']},
    

    Also, add .slim to the list of extensions:

    resolve: {
      extensions: ['.js", <etc>, ".slim"]
    },
    
  4. load templates from javascript:

     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 to slimrb using following syntax:

loader: [
  {
    loader: 'slim-lang-loader',
    options: {
      slimOptions: {
        'disable_escape': true
      }
    }
  }
]

Keywords

FAQs

Package last updated on 27 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc