electron-stylus
v0.1.1
Published
A dead simple Stylus loader for Electron app
Downloads
4
Readme
Electron Stylus
A dead simple Stylus loader for Electron app
This module is on working... take care if you want to use in Production.
How to
Install it with NPM.
npm install -S electron-stylus
Use it in your HTML file.
<script>
require('electron-stylus')(__dirname + '/path/to/stylus.styl')
</script>
It will return a Promise with css string.
require('electron-stylus')(__dirname + '/path/to/stylus.styl')
.then(function (css) {
console.log(css)
console.log('successfully loaded')
})
Example code also included. I hope you to enjoy.
Go scratch
Install stylus
npm install -S stylus
Write this code in your HTML file.
<script>
var stylus = require('stylus')
var str = require('fs').readFileSync(__dirname + '/../styles/main/index.styl', 'utf8')
stylus(str)
.set('filename', __dirname + '/../styles/main/index.styl', 'utf8')
.render(function(err, css){
if (err) throw err
var style = document.createElement('style')
style.innerText = css
style.type = 'text/css'
document.head.appendChild(style)
})
</script>
License
ISC License (ISC)
Copyright (c) 2015, Dick Choi