https://github.com/jstransformers/jstransformer-myth
Myth support for JSTransformers.
https://github.com/jstransformers/jstransformer-myth
Last synced: over 1 year ago
JSON representation
Myth support for JSTransformers.
- Host: GitHub
- URL: https://github.com/jstransformers/jstransformer-myth
- Owner: jstransformers
- License: mit
- Created: 2015-04-03T00:28:53.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2020-04-26T04:19:28.000Z (about 6 years ago)
- Last Synced: 2025-03-06T08:05:13.150Z (over 1 year ago)
- Language: JavaScript
- Homepage: http://npm.im/jstransformer-myth
- Size: 66.4 KB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.md
Awesome Lists containing this project
README
# jstransformer-myth
[Myth](http://npm.im/myth) support for [JSTransformers](http://github.com/jstransformers).
[](https://travis-ci.org/jstransformers/jstransformer-myth)
[](https://codecov.io/gh/jstransformers/jstransformer-myth)
[](http://david-dm.org/jstransformers/jstransformer-myth)
[](https://www.npmjs.org/package/jstransformer-myth)
## Installation
npm install jstransformer-myth
## API
```js
var myth = require('jstransformer')(require('jstransformer-myth'))
var opts = {};
myth.render('pre {\n margin: calc(50px * 2);\n}', opts).body;
//=> 'pre {\n margin: 100px;\n}'
var promise = myth.renderFileAsync('./path/to/hello.myth', opts);
promise.then(function(data) {
console.log(data.body);
//=> 'pre {\n margin: 100px;\n}'
});
```
**future.css**
```css
:root {
--purple: #a6c776;
--size: 1.2rem;
}
@custom-media --narrow-window screen and (max-width: 30em);
@media (--narrow-window) {
html {
font-size: var(--size);
}
}
a {
color: var(--purple);
}
```
will be transformed to
```css
@media screen and (max-width: 30em) {
html {
font-size: 1.2rem;
}
}
a {
color: #a6c776;
}
```
## License
MIT