Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Exclude files / folders from clean task #303

Open
johanneslamers opened this issue Jun 28, 2016 · 10 comments
Open

Exclude files / folders from clean task #303

johanneslamers opened this issue Jun 28, 2016 · 10 comments

Comments

@johanneslamers
Copy link

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?

@greypants
Copy link
Contributor

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.

@fyllepo
Copy link

fyllepo commented Aug 17, 2016

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.

@1stevengrant
Copy link

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

@greypants
Copy link
Contributor

@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.

@1stevengrant
Copy link

good shout

@greypants
Copy link
Contributor

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.

@elivz
Copy link
Contributor

elivz commented May 27, 2017

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.

@greypants
Copy link
Contributor

@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
Copy link
Contributor

@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.

@elivz
Copy link
Contributor

elivz commented May 29, 2017

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants