Question: best way to include sweet.js in my project
xmclark opened this issue · 4 comments
Hey there I discovered this project a few weeks ago, and have been learning the macro syntax. I like it a lot and would like to add it to a project.
I’m curious about a good way of adding it in a maintainable way. So far, all examples I have found put the macro syntax in the same JavaScript file as the source. I would like to separate my macros into different files and include the macros at build time. I also want to add sjs into my build pipeline that might use Babel and Webpack or Gulp.
What are the best practices or tools to use for a project using sweet macros?
You can use modules: https://www.sweetjs.org/doc/tutorial#sweet-modules
I guess I had missed this part of the tutorial. My bad.
Sweet modules works pretty well for exporting syntax. With exporting/importing modules, I can see this scaling pretty well.
Thanks, I think this resolves me issue for me.
I can imagine most build systems can use the sjs cli to preprocess sweet macros in a project.