jsoverson / preprocess

Preprocess HTML, JavaScript, and other files with directives based off custom or ENV configuration
Other
366 stars 80 forks source link

@include as string #93

Closed Mottie closed 9 years ago

Mottie commented 9 years ago

In my build process, I compile sass and I would like to inject it into the page (I'm working on a bookmarklet). When using the following format, preprocess leaves the @include untouched.

var el = document.createElement( 'style' );
document.querySelector( 'head' ).appendChild( el );
el.innerHTML = '@include-static src/compiled-from-sass.css';

I'll switch to use a replace method for now, unless there is a correct method of which I am unaware?

Frizi commented 9 years ago

use this instead

el.innerHTML = '/* @include-static src/compiled-from-sass.css */';

preprocess is just a set of semi-dumb regex replaces, it doesn't care about strings ;) A comment-like string is just as good as a real comment for it.

Mottie commented 9 years ago

Oh that's great thanks!