isaackoz / vite-plugin-preact-esp32

Convert Preact SPA to a header file to be used on an ESP32 webserver.
MIT License
2 stars 1 forks source link

Config options #3

Open jsaddiction opened 1 week ago

jsaddiction commented 1 week ago

Is it possible to establish a config for a directory (probably relative) in which the output file could reside? Same question for the filename. My web directory is within a PIO project. Something like:

project
    include
    lib
    src
        display
        ntp
        rtc
        web_ui
            static_files
            front_end
                node_modules
                public
                src

Would be a bonus if the npm build could just place the static_files.h directly into the web_ui/static_files directory. Further automating my environment I could establish a call to npm build directly before compilation and uploads which would produce the most updated static_files.h in the expected directory referenced by my application.

I am open to other suggestions on how you have used this. I don't understand your code or I would have submitted a pull request instead.

TIA

isaackoz commented 1 week ago

Hi Justin, thank you for taking interest in this project, but I am currently finishing up uni and have about 50 days left so I haven't and don't have the time to work on this right now. Feel free to fork this project and do whatever you'd like with it. As for the code, basically all it's doing is grabbing the static output files from the build process (in src/index.js) and then converting them to byte arrays in the EJS template file (static_files_h.ejs) which outputs a c++ header file.

I realized while working on this that it didn't make sense to make this as a plugin for a specific bundler/framework and it would be better as a generic standalone CLI tool. Theoretically this concept should work for any static output for any framework. With a CLI tool, you could integrate it in any build process, regardless of environment. I do intend to work on a standalone CLI sooner than later. In the meantime, I would suggest either forking this and modifying it yourself or wait. I'll see if I can throw together a quick-n-dirty version of it in the next few days.