Munter / tolk

A file reader that promises to translate non-web assets to web assets given the available transpilers. Autoprefixing, sourcemaps and all!
27 stars 0 forks source link

Split into seperate modules #17

Open davej opened 9 years ago

davej commented 9 years ago

Tolk on it's own does too much for my purposes, so in the spirit of "small modules that do one thing"! :-)

Tolk could still be the same but perhaps it could rely on a lower level library that doesn't inline source maps and autoprefix the css. The "pre-tolk" module might have an API that looks like:

var preTolk = require('pre-tolk');

preTolk.read('path/to/stylesheet.scss').done(function (compiled, sourceMap) {
  // compiled code and source maps are separate in this lib
  // you can then autoprefix and inline the sourcemap after
  console.log(compiled);
  console.log(sourceMap);
}, function (err) {
  // In case anything failed
  throw err;
});

edit: It would probably also need to pass back the outputExtension or outputFilename.

davej commented 9 years ago

I did this for my own purposes. :-)

There's not much to it but of course feel free to take it over under your username and rename it or do what ever you want. Changes are self explanatory, also removed two tests, added one.

https://github.com/davej/baby-tolk