blendid icon indicating copy to clipboard operation
blendid copied to clipboard

Exclude files / folders from clean task

Open johanneslamers opened this issue 8 years ago • 10 comments

I'm working on a large site with some extra folders in the root of the website (./public/) with client related stuff. When I build the site with gulp-starter the whole root folder gets cleaned (cleared). Is it possible to set an extra config param to exclude folders / files from the clean task?

johanneslamers avatar Jun 28 '16 06:06 johanneslamers

Not a bad idea. That's sort of what I created the static task for, though it was more for things like favicons. You could put all of the persistent client stuff in assets/static, and it'd just get re-copied over to the root untouched every time.

Or nest your assets in public, so the root dest is something like 'public/assets', and the only the only thing that gets wiped out is that assets folder.

But I'm open to adding configuration as well. I feel like I started to add that at somepoint but hit some issues and never finished.

greypants avatar Jul 05 '16 14:07 greypants

I'm certainly in favor of this feature... or instead of deleting the actual config.root.dest folder, perhaps adding config options for the clean task so its possible to negate certain folders...

I will try put something together shortly.

fyllepo avatar Aug 17 '16 19:08 fyllepo

yeah, especially when it wipes out index.php for your CMS :)

1stevengrant avatar Aug 23 '16 12:08 1stevengrant

@stevieg83 you can get around that by change your root dest to something like assets, so only your assets folder gets wiped out by the clean task.

greypants avatar Aug 23 '16 17:08 greypants

good shout

1stevengrant avatar Aug 25 '16 22:08 1stevengrant

We definitely need to address this. There's a couple of routes we could go, and maybe it's a combination of them:

  1. We can add an exclude folders/files option like @johanneslamers suggested
  2. Provide an include folders/files option (inverse of above)
  3. We can also add an option to disable the "clean" step - but that'd create some problems if you're using file revisioning... new files would just keep piling up.

greypants avatar May 12 '17 13:05 greypants

Yes please! I am working on switching over to Blendid from my homegrown build process, but I want to use a customized HTML task to copy my Craft templates to dist/craft/templates (so I can hard-code the revved asset filenames during build). That means I need to use dist as my dest folder...which means the clean task wipes out Craft every time. I would probably lean towards whitelisting rather than blacklisting, but either one would work for my purposes.

elivz avatar May 27 '17 17:05 elivz

@elivz why do you need to hard-code the filenames? We included a Craft plugin to handle that automatically: https://github.com/vigetlabs/blendid/blob/master/extras/craft/ASSETS-README.md

greypants avatar May 28 '17 00:05 greypants

@elivz

I would probably lean towards whitelisting rather than blacklisting, but either one would work for my purposes.

Good call, I think that's a probably a better approach.

greypants avatar May 28 '17 00:05 greypants

Well, I guess I don't need to. But it's always seemed cleaner to me to handle all the revisioning in the build process and not have the extra plugin dependency. I already modified the rev task to replace the asset urls in my Twig templates (PR coming...), now I just need to find a way to move those template files outside of the webroot without "cleaning" my entire CMS installation every time.

elivz avatar May 29 '17 01:05 elivz