I’m building a package with a compile plugin that needs to be aware of it’s execution path, as Node’s __dirname & __filename don’t work in Meteor does anybody know if this can be achieved reliably?
Presumably they don’t work because they get passed straight through to the combined JS file?
Doesn’t sound like it would be impossible for the JS processor to substitute with literals.
This is one of those awkward CSS compilation problems where the compiler needs to access imports that are included via an npm library.
The package defines a hook for a type of .css file, then runs it through rework that includes basscss as a local NPM module dependency. I need to transform all @import ‘xxx’ module paths to point to the basscss NPM package and all relative includes to remain relative to the original input file location.
eg:
– in meteor app
client/my-css-definition.HOOK.css
rewrites to original file location path using compileStep.inputPath || compileStep.fullInputPath
processes the result through the transform
returns the output using compileStep.addStylesheet()
If this is possible it will allow me to write a nice set of modular extensions to basscss in my meteor app and include exactly what is necessary per application.
But if it sounds crazy feel free to sway me otherwise
The problem you are facing is something that several people at MDG were thinking about lately.
Right now it is a known problem with the Meteor packaging system, sharing a stylesheet in a format of Less or Sass mixings is not possible w/o hacks. Sadly, I don’t have any good advice on how to achieve this at the moment, all solutions I’ve heard were very hacky.
Good to know, is there an issue open for this or is it just on the radar? Happy to contribute to a solution as I see this becoming more important for building larger apps that share components.