troccoli's avatar

Automatically add content to tailwind.config.js

I am writing a theme for our brand to be reused in all our apps. This is a package that uses TailwindCSS.

The installation process can all be automated but for configuring Tailwind.

Specifically I need to add a preset and a few lines in the content section.

Has anybody done this before? Or does anybody have any tips on how to about it?

Thanks

0 likes
2 replies
troccoli's avatar

I know I can parse the file, and I am using the mck89\peast package. Does anyone have any experience with that package?

$ast = Peast::latest('./tailwind.config.js.backup', [Peast::SOURCE_TYPE_MODULE])->parse();

This returns and error

Unexpected: .
troccoli's avatar

The reason that did not work is that Peast::latest wants the content of the file, not its filename

$ast = Peast::latest(File::get('./tailwind.config.js.backup'), [Peast::SOURCE_TYPE_MODULE])->parse();

Please or to participate in this conversation.