Живая перезагрузка в продакшене

:information_source: Краткое описание Возвращение перезагрузки CSS в продакшн
:hammer_and_wrench: Репозиторий https://github.com/communiteq/discourse-tc-livereload
:question: Руководство по установке Как установить тему или компонент темы

Установить этот компонент темы

В августе живая перезагрузка CSS была отключена в продакшн-среде.

Теперь я использую свою среду разработки для плагинов, но в большинстве случаев я разрабатываю компоненты тем на тестовом сервере, который технически является продакшном, но на нём работают только люди, понимающие, что нужно нажать F5 при возникновении странных проблем.

Я создал этот компонент темы, чтобы вернуть живую перезагрузку в средах, отличных от разработки.

Поскольку это действительно может вызвать проблемы (что и стало причиной её удаления), функциональность можно ограничить для конкретных групп. По умолчанию это staff. Группы можно изменить в настройках компонента темы.

Тем не менее, не рекомендуется использовать этот компонент темы, если вы не знаете, что делаете :face_with_open_eyes_and_hand_over_mouth:

11 лайков

Hooray! I would love to have this move to core and apply only to admins, or be disabled by default and force people to add a group to have it apply to.

I was doing pretty much all of my theme development on production sites (though usually a staging techincally-production site).

Thanks very much!

2 лайка

As long as there’s an appropriate disclaimer in the description, a new group-based site setting in core sounds fine. pr-welcome

I’d still strongly recommend against developing on a production instance as a day-to-day thing. Tons of useful errors & debug information is stripped out of production builds, so you won’t get useful feedback when things go wrong.

5 лайков

Nice!

Aha. Maybe it’s good to force a hack like me to get better hints, then. I’m often at a loss at what’s gone wrong. Maybe this is why!

But for simple CSS and color tweaks, there’s probably no danger, I’d imagine.

4 лайка

Yeah from a debugging point of view, there isn’t much difference between dev/prod for CSS files.

But going back to the ‘live reload’ problem - that is CSS-specific. If stylesheets from a newer version of Discourse are inserted into a page running an older version of Discourse, that is likely to cause surprising issues for end-users.

That’s why we updated things so that the CSS update is deferred until the next page navigation, so it now lines up with the JS updates.

4 лайка