Jump to content

Most optimal place to store built assets?


Jonathan Lahijani
 Share

Recommended Posts

I use Laravel Mix (webpack) as my build tool and the resulting files (js, css, fonts, images) get stored in /site/templates/dist/.  My package.json is in /site/templates/.

When using Laravel Mix with Tailwind 2 and its JIT compiler however, I hit a known infinite loop issue due to limitations with webpack:
https://tailwindcss.com/docs/just-in-time-mode#styles-rebuild-in-an-infinite-loop

To counteract this, I could put my dist folder inside /site/assets/.  ProCache's built files go inside /site/assets/ as well in a 'pwpc' directory.

Therefore my question is: Is it more 'proper' to put frontend built files in /site/assets/(subfolder-name)/ as opposed to /site/templates/(subfolder-name)/ ?

Link to comment
Share on other sites

On 11/18/2021 at 2:51 PM, bernhard said:

/site/assets is supposed to be writable while /site/templates is not

It is a bit "hidden" but somewhat documented over here: https://processwire.com/docs/security/file-permissions/#securing-your-site-config.php-file

Quote: "This includes /site/assets/ and everything within it, as well as /site/modules/ and everything in it (if you want to have a writable modules file system). Read the next section for details on how to do this."

Also, the PW installer is also informative (sure, these are the conditions required by the installer, so later on /site/modules and config.php can be locked down, as also explained in the docs):

Spoiler

ProcessWire.png.0e3247705ccb21df197695da1eb7e0ef.png

 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...