3

I'm taking my first steps with Drupal 8, starting with a custom theme. As a result I'm making incremental changes and testing them.

I've found that in order to be able to tweak CSS you have to turn off aggregation. The normal: change css, drush cc css-js, reload page workflow doesn't work unless aggregation is disabled.

But I'm also having difficulty with Drupal not picking up changes to the yaml files, e.g. add css to the THEME.libraries.yml file - no drush cc ... command has any effect. The only thing I've found to work is drush cr (or drupal cache:rebuild) which adds about 20-30s delay in my workflow.

Is there a quicker workflow for development?

10
  • 20-30 seconds is insane, all of my D8 sites rebuild cache within a couple seconds. Maybe it's a problem with drupal console, try using drush cr all
    – Clive
    Commented Mar 8, 2016 at 11:46
  • time drush cr all: 10.69s user 0.26s system 63% cpu 17.123 total. And then the next page load takes ages, too of course. That's on a VM with 4Gb RAM and 2 cores and SSD drives, 2 nodes(!) and nothing else. time drupal cache:rebuild all 11.38s user 0.29s system 62% cpu 18.678 total Commented Mar 8, 2016 at 11:49
  • 2-3x quicker is certainly an improvement, but 10+ seconds is still odd in my experience. Try giving the VM more resources to check if that's the issue
    – Clive
    Commented Mar 8, 2016 at 11:51
  • Where did you get that 2-3x from? drush cr all took 17s life seconds, drupal took 18s. More resources is not an option. Commented Mar 8, 2016 at 11:55
  • time drush cr all: 10.69s 30/10 ~= 3
    – Clive
    Commented Mar 8, 2016 at 11:58

2 Answers 2

2

In your development.services.yml file turn twig cache off and debug true. This will assist in theming, twig files are also cached.

Secondly, I think the command you want for yml changes is drush cr. However if they are install yml files, (I believe) they'd only register when a theme is enabled/uninstalled like modules are. So if that's the case you'd need to do that. I've also needed to use cr with libraries.yml changes.

Third, what VM are you using? I can run drush cr and it only takes ~5 seconds on the DrupalVM stack.

5
  • Thanks for tips. drush cr and drupal (console) cache:rebuild are the same thing. cr stands for cache rebuild... And they perform the same - see my comment (which also covers some VM details) Commented Mar 8, 2016 at 11:58
  • Right but what version of php, how much php memory, all that stuff? Is it a vanilla VM or specifically tuned LAMP stack?
    – Kevin
    Commented Mar 8, 2016 at 12:00
  • That's not what you've put in your question @artfulrobot - drupal cache:rebuild isn't Drush, completely different bit of software, they might produce different results. May not be the problem, but it's good to be clear
    – Clive
    Commented Mar 8, 2016 at 12:00
  • The commands may have the same purpose, but I haven't looked to see if they do the same thing. Console is still brand new and I have found it to be buggy, drush will be my tool until they pull the plug on it.
    – Kevin
    Commented Mar 8, 2016 at 12:02
  • @clive Sorry for "are the same". What I meant was that they are supposed to do the same thing; they achieve the same result (changes are noticeable) and they take the same time to do it. Have edited Q. Commented Mar 8, 2016 at 12:06
2

Configuration Development does several helpful things for Configuration Management. Among them, the one you need is:

Automated import of configuration files into the active storage. At the beginning of every request the changed files are saved the way as if it were dumped in the core config module provided "Single import" form.

This means that instead of reading your YAML configuration only when you enable your module, Drupal will reload changes on runtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.