CodeKit icon indicating copy to clipboard operation
CodeKit copied to clipboard

[FEATURE REQUEST] Allow build process to output to a subdirectory

Open furioursus opened this issue 4 years ago • 2 comments

I’m working with CodeKit and its build feature, but I’m hitting what may be a wall based on how some CMSes work.

My main issue is that the build feature only allows us to output to a root directory. In most cases, that works, but for instance, I am working with Craft CMS, and it serves content from the /web directory, which also houses the system’s index.php file, but also generates a folder called /web/cpresources with template caches and much more.

When I set up the build process to point to the /web directory, the default behavior is that the folder is emptied out and then populated. This wipes out anything in there, such as an index.php file. I would just put said file in the /source directory, but the problem is that the /web/cpresources directory is deleted too. Now I could change the build behavior to not wipe out the directory first, but this means sourcemap files will be left in the directory and they won't point to anything correctly.

My proposal is this: allow us to choose a subdirectory for the build folder. This change would allow a build folder to be used either at root, or in a document folder without endangering existing content.

Happy to provide more of an explanation if I'm not clear here.

furioursus avatar Feb 12 '21 22:02 furioursus

In theory, the build folder could be anywhere.

However, it seems like the best solution is to have Craft CMS re-generate the /web/cpresources/ folder and its content after a build completes. You would do that by adding a "Run Script" Build Step to CodeKit that calls out to Craft CMS to have it do its thing: codekitapp.com/help/build/

Alternately, you can add a Build Step that simply deletes all *.map files within the build folder.

There are a few technical reasons (mostly having to do with speed optimizations) that I've prevented the build folder from being buried multiple levels deep in a project.

bdkjones avatar Feb 20 '21 09:02 bdkjones

However, it seems like the best solution is to have Craft CMS re-generate the /web/cpresources/ folder and its content after a build completes. You would do that by adding a "Run Script" Build Step to CodeKit that calls out to Craft CMS to have it do its thing: codekitapp.com/help/build/

Right, it shouldn't be too much a of a problem. I was just using it mostly as an example of the build folder not being able to be anywhere but at the project root.

Alternately, you can add a Build Step that simply deletes all *.map files within the build folder.

This is a pretty good idea, and probably what I'm going to try next!

There are a few technical reasons (mostly having to do with speed optimizations) that I've prevented the build folder from being buried multiple levels deep in a project.

This makes sense. What if the build process didn't delete and replace the build folder, but instead emptied out all contents from it? I'm unsure if that would be a performance issue, but one solution I was hoping to use was symlinking the build directory with a subdirectory in my webroot. It worked fine while saving and working with existing files, of course, but hitting "build" wiped out the symlink and replaced it with an actual folder. Then again, maybe this would be the same problem with regards to performance.

In any case, I appreciate the response!

furioursus avatar Feb 20 '21 09:02 furioursus