Skip to content

Allow publicDir to be deleted and next compile recreates it #14

Closed
@EvanLovely

Description

@EvanLovely

Steps to recreate

composer create-project drupal-pattern-lab/edition-twig-standard ~/Desktop/test --no-interaction
cd ~/Desktop/test
# Now we have a working install
php core/console --generate
# Compile runs fine.

That sets everything up fine. Next:

rm -rf public
php core/console --generate

We get this output:

configuring pattern lab...
i can't seem to find the directory ./public...
i created ./public just in case. you can edit this in ./config/config.yml by editing publicDir...
./public/index.html is missing. grab a copy from your StyleguideKit...

This is the bug I want fixed. It should just see that stuff is missing and do what needs to be done. Here's a few more details on this: All this does is create an empty directory ./public. It wants us to grabs a new copy of our styleguidkit. When one tries to fix this, typically this is attempted:

composer install

That doesn't work either; you actually have to run:

rm -rf vendor
composer install
php core/console --generate
# Now it compiles fine

So basically if someone deletes ./public, they also need to delete ./vendor and run composer install again: which is counter-intuitive and a little time consuming.

Why I want this is so all compiled files (CSS, JS, PL, etc) can live in a single folder that can be deleted. This would not only allow a reliable clean and recompile step to be done, but allow the public folder to be placed into many other locations.

Background

These are the folders inside a working publicDir after a compile:

  • annotations
  • css
  • favicon.ico
  • fonts
  • images
  • index.html
  • js
  • latest-change.txt
  • patternlab-components
  • patterns This is the compiled HTML from Pattern Lab
  • styleguide

That patterns folder is what gets deleted and re-compiled when cleanPublic is true - not the whole publicDir folder. The rest is things like PL chrome (the StyleguideKit), so it doesn't make sense to copy it over on each compile; however, if it's missing I want it to fix it when a compile is ran.

Thoughts on this @drupal-pattern-lab/core ?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions