hook into preprocessor


is there a way to add a step before the normal arduino preprocessor starts its work?

Some background information:

I’m using arduino IDE for ESP8266 dev work where the esp is serving websites.

I’d like to use .css .js and .html files within the arduino project folder and minify them and generate a temp .ino file where the content of each file is set as a variable value.

After that the normal build process should start.

Any ideas?


There is a list of hooks here: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#pre-and-post-build-hooks-since-ide-165 but I'm guessing recipe.hooks.sketch.prebuild.NUMBER.pattern actually happens after the sketch preprocessing. Is that correct?

I don't see any reason why you would need your generated file to be run through the preprocessor though. How about turn it into a .h file and copy it to the temporary build folder. It would be brought into your sketch by an include of the generated .h file. If you do that then recipe.hooks.sketch.prebuild.NUMBER.pattern should work fine for your needs.

hi pert,

thanks for your response.

This is all new to me and you helped me a lot.

I will build a prototype and see if it can do what I need.


I'd be interested to hear how it goes. It sounds like a cool project. I don't see these hooks used very often but it's nice the Arduino developers added them.


I’ve started documenting my “progress” on my blog.

Starting a rudimentary HTML template and code minifier for Arduino IDE and ESP8266