hagenburger / pimd

PIMD – Processing Instructions for Markdown
https://hagenburger.github.io/pimd-docs/
MIT License
20 stars 5 forks source link

Support for CSS/JavaScript processors #25

Open hagenburger opened 6 years ago

hagenburger commented 6 years ago

Define a way to integrate processors for CSS and JavaScript. Those could be: PostCSS, Sass/SCSS, Less, Coffee-Script, Babel, …

Current situation

CSS and JavaScript can be added via:

document.contents.add('css', 'a { color: blue }')
document.contents.add('javascript', 'alert("Hello world")')

And retrieved via:

document.contents.get('css')
document.contents.get('javascript')

Pre processors

Languages that require a preprocessor (for example Sass, SCSS, Less, Coffee-Script), must use their own content type:

document.contents.add('scss', 'a { color: lighten(blue, 10%) }')

Those need a hook to be converted into either CSS or JavaScript before rendering the document.

“Post” processors

Autoprefixer and BabelJS should convert either CSS or JavaScript after the pre processors have been converted and before the document gets rendered.

Open questions