4.0.3 • Published 7 years ago
sugo-module-scss v4.0.3
sugo-module-scss
SUGOS module of scss compiler
Requirements
Installation
$ npm install sugo-module-scss --save
Usage
Register module to SUGO-Actor
#!/usr/bin/env node
/**
* Example usage to register module on actor
* @see https://github.com/realglobe-Inc/sugo-actor
*/
'use strict'
const sugoModuleScss = require('sugo-module-scss')
const sugoActor = require('sugo-actor')
const co = require('co')
co(function * () {
let actor = sugoActor('http://my-sugo-cloud.example.com/actors', {
key: 'my-actor-01',
modules: {
// Register the module
scss: sugoModuleScss({})
}
})
yield actor.connect()
}).catch((err) => console.error(err))
Then, call the module from remote caller.
#!/usr/bin/env node
/**
* Example to call from caller
* @see https://github.com/realglobe-Inc/sugo-caller
*/
'use strict'
const co = require('co')
const assert = require('assert')
const sugoCaller = require('sugo-caller')
co(function * () {
let caller = sugoCaller('http://my-sugo-cloud.example.com/callers', {})
let actor = caller.connect('my-actor-01')
// Access to the module
let scss = actor.scss()
// Send ping
let pong = yield scss.ping()
assert.ok(pong)
// Compile scss
let compiled = yield scss.compile(`
body { h1 { color: #555;} }
`)
console.log(compiled)
}).catch((err) => console.error(err))
Methods
The following methods are available from remote callers for the module.
.ping(pong) -> string
Test the reachability of an module.
Param | Type | Description |
---|---|---|
pong | string | Pong message to return |
.assert() -> boolean
Test if the actor fulfills system requirements
.compile(scss) -> string
Compile scss to css and put prefixes.
Param | Type | Description |
---|---|---|
scss | string | scss striing you want to compile |
License
This software is released under the Apache-2.0 License.
Links
4.0.3
7 years ago