-
Notifications
You must be signed in to change notification settings - Fork 134
Force skipping vite dev server #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
def lookup(name, type: nil) | ||
@build_mutex.synchronize { builder.build } if should_build? | ||
def lookup(name, type: nil, force_build: false) | ||
@build_mutex.synchronize { builder.build } if force_build || should_build? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, we don't want to force build in production for example.
The correct way should be something like config.auto_build && (!dev_server_running? || force_build)
Hi Adrien! On my phone right now, I'll get back to this during the week. At a first glance it seems that premailer supports fetching css from a URI, so perhaps it's a matter of configuring the resolution so that it doesn't assume it's a local file. That would have the added benefit of being extremely fast during development, as Vite would only process the requested stylesheets instead of triggering a full build. |
In my case I am using SCSS with tools like foundation for emails so I do
require a build and not just forwarding the file
On June 20, 2021, GitHub ***@***.***> wrote:
Hi Adrien!
On my phone right now, I'll get back to this during the week.
At a first glance it seems that premailer supports fetching css from a
URI
<https://github.com/premailer/premailer/blob/master/lib/premailer/premailer.rb#L324>,
so perhaps it's a matter of configuring the resolution so that it
doesn't assume it's a local file.
That would have the added benefit of being extremely fast during
development, as Vite would only process the requested stylesheets
instead of triggering a full build.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#93 (comment)>,
or unsubscribe <https://github.com/notifications/unsubscribe-
auth/AAGEHNLNMD5KXOISR6EMXGTTTYF5JANCNFSM47AD4C7Q>.
|
If you can share a minimal repo with the intended usage I can take a look. Vite does not serve the file as-is—it would run it through sass and process any imports within the file, so premailer should be able to parse it correctly. |
I understand what you mean. I think the main issue is that the file premailer reads contains import statements. While the browser can resolve those premailer expects a complete single css file. Is that clearer? Otherwise I will provide with a repro |
Anyway here's a repro :) https://github.com/Intrepidd/vite_ruby_issue Steps are described in the readme, let me know if I can help |
Thanks for sharing a sample repo. As I mentioned before, it's possible to request the processed CSS from Vite. This is insanely faster than building, and it seems to work nicely in the example repo 😃 @Intrepidd Please see the following options, and let me know how it goes! The default The problem is that no I opened a PR in In the meantime, you could define a custom strategy for Premailer, for example, in if Rails.env.development?
module ViteNetworkLoader
def self.load(url)
return unless ViteRuby.instance.dev_server_running?
return unless url.start_with?("/#{ViteRuby.config.public_output_dir}/")
Net::HTTP.get(URI("http://localhost:1111#{url}"), { 'Accept' => 'text/css' }).presence
end
end
Premailer::Rails.config.fetch(:strategies) << ViteNetworkLoader
end Patch for your example appdiff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb
index 76ce8b3..d654ce3 100644
--- a/app/views/layouts/mailer.html.erb
+++ b/app/views/layouts/mailer.html.erb
@@ -2,7 +2,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <%= vite_stylesheet_tag 'application.scss', host: "http://localhost:1111" %>
+ <%= vite_stylesheet_tag 'application.scss' %>
</head>
<body>
diff --git a/config/initializers/premailer.rb b/config/initializers/premailer.rb
new file mode 100644
index 0000000..18c51c2
--- /dev/null
+++ b/config/initializers/premailer.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+if Rails.env.development?
+ module ViteNetworkLoader
+ options = Rails.application.config.action_mailer.default_url_options
+ HOST_WITH_PORT = "http://#{options.fetch(:host)}:#{options.fetch(:port)}"
+
+ def self.load(url)
+ return unless ViteRuby.instance.dev_server_running?
+ return unless url.start_with?("/#{ViteRuby.config.public_output_dir}/")
+ Net::HTTP.get(URI("#{HOST_WITH_PORT}#{url}"), { 'Accept' => 'text/css' }).presence
+ end
+ end
+
+ Premailer::Rails.config.fetch(:strategies) << ViteNetworkLoader
+end |
This allows development servers to serve the correct file type. For more information see ElMassimo/vite_ruby#93 (comment)
Thanks! I had no idea you could do that with the accept header! I was confused because from my browser or curl I would see the import statements. Sorry for the confusion and thanks for your help! |
It doesn't work with vite. We might have to rework our mails styling afterwards. Or might want to integrate it again according to this: - fphilipe/premailer-rails#261 - ElMassimo/vite_ruby#93 (comment)
* Update Rails dependency to 8.0.2 * Perform update via `bin/rails app:update` & manually review * Fix load defaults version * Upgrade schema file * Remove cache control header for test environment (since we don't cache there anyways) * Fix RuboCop errors (mainly new `params.expect()` unsafe autocorrects) * Patch Devise for Rails 8 See heartcombo/devise#5728 (comment) * Fix incorrect array syntax in params * Don't require an array for quizzes * Remove array for question_attributes in vignettes * Use permit for structure_params & remove unused comment_params * Expect lecture updates to fail (due to params being stricter) * Fix invalid syntax for course controller * Fix vignette @answers=nil error during preview * Fix missing `basics.division` translation * Permit `ValidationContext` class in `YAML.safe_load()` This is because Psych got stricter about which classes can be deserialized for security reasons. Maybe related: https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017 * Remove duplicate config line * Remove webpacker and sass-rails & add basic vite_rails config See this blog post by the creator of vite-rails: https://maximomussini.com/posts/a-rubyist-guide-to-vite-js#getting-started I've added the vite_rails gem, installed it, then ran: bundle exec vite install (Note that I removed the app/javascript folder beforehand, only locally, as we don't need it.) This is to get a basic setup. Nothing is expected to work at this moment. * Move vite_client_tag to global _head file (since this file is referenced also from other layout files) * Init basic bootstrap setup See the Bootstrap&Vite guide here: https://getbootstrap.com/docs/5.3/getting-started/vite/#configure-vite * Remove webpack-dev-server * Use jquery with Vite (remove Ruby gem) According to this post: https://dev.to/chmich/setup-jquery-on-vite-598k * Remove Sprockets (first migration step) See https://github.com/rails/propshaft/blob/main/UPGRADING.md#3-migrate-from-sprockets-to-propshaft Did not yet replace all asset_helpers (`image_url`, `font_url`) with standard `url`s. And did also not include Propshaft since I want to see what Vite can do for us first. Maybe we don't even need Propshaft after all? * Delete webpacker configuration 🥳 * Revert "Remove Sprockets (first migration step)" This reverts commit c8567a5. * Remove empty API assets (legacy) * Move stylesheets from `app/assets/stylesheets` to `app/frontend/entrypoints` Later, those shouldn't be global stylesheets anymore as this is heavily polluting. * Remove jquery-ui (not to confuse with jQuery itself) Didn't find out where it was needed... * Use Vite tag helpers Performed auto-replacing: `stylesheet_link_tag` ->`vite_stylesheet_tag` `javascript_include_tag` -> `vite_javascript_tag` See also: https://vite-ruby.netlify.app/guide/rails.html#tag-helpers-%F0%9F%8F%B7 * Remove old `app/javascript` folder (and move code to `application.js`) * Fix Bootstrap SCSS imports * Add back in bootstrap_form gem * Move stylesheets to subfolder (we add this subfolder as Vite entrypoint as well) * Fix no default import of `friendly-challenge` * Update vite_stylesheet_tag subfolder & use explicit file endings (the latter is for better performance) * Place javascript files in frontend folder * Add back in rails-sass only for sprockets pipeline * Correct vite_javascript_tag paths for subfolder usage (add `js/` at beginning) * Use vite_image_tag instead of image_tag & correct paths This has to be revised again as I'm not sure yet how vite_image_tag deals with absolute URLs passed to it. For commontator, we have to leave `image_tag`, such that the sprockets assets pipeline is used. * Convert sprocket requires to js imports * Use "~/" instead of "@/" Looks nicer and helps to distinguish from @npm packages * Add coffeescript Vite plugin & fix js imports * Use image_tag for urls & add missing .scss file extension * Include all bootstrap stylesheets * Fix CSS url path * Fix fonts path * Remove console.log * Configure Vite in Docker Compose * Load coffee plugin first to then inject JQuery * Use turbolinks npm package instead of gem * Init fixing JS reference errors by using new ES6 import syntax * Fix masonry & bootstrap/jquery issues * Rework einstein tiles p5 code for modern JS * Bring back public assets to respective folder * Rework Thyme-related JS files * Globally define `initBootstrapPopovers` * Remove coffeescript Rails gem * Also initialize bootstrap popovers on page load * Import bootstrap Toast for feedback JS * Ignore SASS legacy API warnings * Add back in missing p5 dependency * Setup js_routes for use with Vite * Remove webpack-related npm packages * Remove core-js dependency Just including it does nothing and there is no occurrence in our code for it. Therefore, we can just as well get rid of it. As we don't even use some very advanced, modern JS features, a polyfill is likely not really necessary. Should we find some weird browser behavior, it's easy to get back to it. * Remove regenerator-runtime The project is archived and I don't see why it was necessary to use it in the first place. * Remove coffeescript dependency * Remove console.logs() * Use production rails env for CI_CD asset bundling * Don't import Thyme-related components everywhere * Add back in coffee-rails * Add in Rails UJS (before migration to Turbo) * Use window-scope for reloadUrl helper function * Fix bootstrap stylesheet import in emails * Add just command to simulate Vite production build (currently without the output from Sprockets) * Remove accidentally commited mampf_routes * Use Sprocket pipeline for Commontator & Thredded assets * Add back in devise-bootstrap-views Also fix minor inconsistencies on signup page * Lint vite config & add back in Node globals to ESLint * Remove sass-loader dependency * Remove clicker sprocket syntax This will break the clicker functionality, but as discussed recently, this functionality is not used anyways anymore and we will get rid of clickers entirely in the future. * Fix geogebra assets inclusion * Fix missing Category import * Fix line too long * Fix talks.coffee -> talke.js & group according to JS/coffee * Configure vite for tests * Align test with dev Ruby environment * Remove premailer rails It doesn't work with vite. We might have to rework our mails styling afterwards. Or might want to integrate it again according to this: - fphilipe/premailer-rails#261 - ElMassimo/vite_ruby#93 (comment) * Fix vite ruby host * Fix js-routes issues due to multiple recompiling * Only recompile js-routes once at container start * Fix lectures people select spec * Use Turbolinks as Ruby Gem again We include it globally via the Sprockets asset pipeline. * Fix setSelectedRange on undefined bug (when the trix editor is not on the page) * Fix new lecture specs * Fix annotations overview tests * Fix commontator JS calling * Don't manually set NODE_ENV in entrypoint script * Add missing backslash to Dockerfile * Print node env * Avoid test failure by not using ampersand HTML entity * Fix mixed JS/coffeescript (Erdbeere) * Build assets in CI/CD using test env * Don't explicitly specify NODE_ENV * Try to also set database url to empty string * Try to not init Rails app during asset precompilation * Unify database adapter env variables * Use new env variable in all places * Don't use vite_image_tag for email attachment urls * Use autobuild for tests such that RSpec tests work * Use Vite Dev Server also for local tests * Don't use anonymous volume for public folder in tests * Remove webpacker env variable * Fix rspec mampf container start (watch for exception) * Don't use any extra volume for public folder since the /usr/src/app is already mounted * Try again to create an anonymous volume for `public/` * Add back deleted test env variables * Remove duplicate `vite_javascript_tag` * Serve production vite assets locally (temporarily to fix bugs) * Revert "Serve production vite assets locally (temporarily to fix bugs)" This reverts commit 33f3f66.
* Update Rails dependency to 8.0.2 * Perform update via `bin/rails app:update` & manually review * Fix load defaults version * Upgrade schema file * Remove cache control header for test environment (since we don't cache there anyways) * Fix RuboCop errors (mainly new `params.expect()` unsafe autocorrects) * Patch Devise for Rails 8 See heartcombo/devise#5728 (comment) * Fix incorrect array syntax in params * Don't require an array for quizzes * Remove array for question_attributes in vignettes * Use permit for structure_params & remove unused comment_params * Expect lecture updates to fail (due to params being stricter) * Fix invalid syntax for course controller * Fix vignette @answers=nil error during preview * Fix missing `basics.division` translation * Permit `ValidationContext` class in `YAML.safe_load()` This is because Psych got stricter about which classes can be deserialized for security reasons. Maybe related: https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017 * Remove duplicate config line * Remove webpacker and sass-rails & add basic vite_rails config See this blog post by the creator of vite-rails: https://maximomussini.com/posts/a-rubyist-guide-to-vite-js#getting-started I've added the vite_rails gem, installed it, then ran: bundle exec vite install (Note that I removed the app/javascript folder beforehand, only locally, as we don't need it.) This is to get a basic setup. Nothing is expected to work at this moment. * Move vite_client_tag to global _head file (since this file is referenced also from other layout files) * Init basic bootstrap setup See the Bootstrap&Vite guide here: https://getbootstrap.com/docs/5.3/getting-started/vite/#configure-vite * Remove webpack-dev-server * Use jquery with Vite (remove Ruby gem) According to this post: https://dev.to/chmich/setup-jquery-on-vite-598k * Remove Sprockets (first migration step) See https://github.com/rails/propshaft/blob/main/UPGRADING.md#3-migrate-from-sprockets-to-propshaft Did not yet replace all asset_helpers (`image_url`, `font_url`) with standard `url`s. And did also not include Propshaft since I want to see what Vite can do for us first. Maybe we don't even need Propshaft after all? * Delete webpacker configuration 🥳 * Revert "Remove Sprockets (first migration step)" This reverts commit c8567a5. * Remove empty API assets (legacy) * Move stylesheets from `app/assets/stylesheets` to `app/frontend/entrypoints` Later, those shouldn't be global stylesheets anymore as this is heavily polluting. * Remove jquery-ui (not to confuse with jQuery itself) Didn't find out where it was needed... * Use Vite tag helpers Performed auto-replacing: `stylesheet_link_tag` ->`vite_stylesheet_tag` `javascript_include_tag` -> `vite_javascript_tag` See also: https://vite-ruby.netlify.app/guide/rails.html#tag-helpers-%F0%9F%8F%B7 * Remove old `app/javascript` folder (and move code to `application.js`) * Fix Bootstrap SCSS imports * Add back in bootstrap_form gem * Move stylesheets to subfolder (we add this subfolder as Vite entrypoint as well) * Fix no default import of `friendly-challenge` * Update vite_stylesheet_tag subfolder & use explicit file endings (the latter is for better performance) * Place javascript files in frontend folder * Add back in rails-sass only for sprockets pipeline * Correct vite_javascript_tag paths for subfolder usage (add `js/` at beginning) * Use vite_image_tag instead of image_tag & correct paths This has to be revised again as I'm not sure yet how vite_image_tag deals with absolute URLs passed to it. For commontator, we have to leave `image_tag`, such that the sprockets assets pipeline is used. * Convert sprocket requires to js imports * Use "~/" instead of "@/" Looks nicer and helps to distinguish from @npm packages * Add coffeescript Vite plugin & fix js imports * Use image_tag for urls & add missing .scss file extension * Include all bootstrap stylesheets * Fix CSS url path * Fix fonts path * Remove console.log * Configure Vite in Docker Compose * Load coffee plugin first to then inject JQuery * Use turbolinks npm package instead of gem * Init fixing JS reference errors by using new ES6 import syntax * Fix masonry & bootstrap/jquery issues * Rework einstein tiles p5 code for modern JS * Bring back public assets to respective folder * Rework Thyme-related JS files * Globally define `initBootstrapPopovers` * Remove coffeescript Rails gem * Also initialize bootstrap popovers on page load * Import bootstrap Toast for feedback JS * Ignore SASS legacy API warnings * Add back in missing p5 dependency * Setup js_routes for use with Vite * Remove webpack-related npm packages * Remove core-js dependency Just including it does nothing and there is no occurrence in our code for it. Therefore, we can just as well get rid of it. As we don't even use some very advanced, modern JS features, a polyfill is likely not really necessary. Should we find some weird browser behavior, it's easy to get back to it. * Remove regenerator-runtime The project is archived and I don't see why it was necessary to use it in the first place. * Remove coffeescript dependency * Remove console.logs() * Use production rails env for CI_CD asset bundling * Don't import Thyme-related components everywhere * Add back in coffee-rails * Add in Rails UJS (before migration to Turbo) * Use window-scope for reloadUrl helper function * Fix bootstrap stylesheet import in emails * Add just command to simulate Vite production build (currently without the output from Sprockets) * Remove accidentally commited mampf_routes * Use Sprocket pipeline for Commontator & Thredded assets * Add back in devise-bootstrap-views Also fix minor inconsistencies on signup page * Lint vite config & add back in Node globals to ESLint * Remove sass-loader dependency * Remove clicker sprocket syntax This will break the clicker functionality, but as discussed recently, this functionality is not used anyways anymore and we will get rid of clickers entirely in the future. * Fix geogebra assets inclusion * Fix missing Category import * Fix line too long * Fix talks.coffee -> talke.js & group according to JS/coffee * Configure vite for tests * Align test with dev Ruby environment * Remove premailer rails It doesn't work with vite. We might have to rework our mails styling afterwards. Or might want to integrate it again according to this: - fphilipe/premailer-rails#261 - ElMassimo/vite_ruby#93 (comment) * Fix vite ruby host * Fix js-routes issues due to multiple recompiling * Only recompile js-routes once at container start * Fix lectures people select spec * Use Turbolinks as Ruby Gem again We include it globally via the Sprockets asset pipeline. * Fix setSelectedRange on undefined bug (when the trix editor is not on the page) * Fix new lecture specs * Fix annotations overview tests * Fix commontator JS calling * Don't manually set NODE_ENV in entrypoint script * Add missing backslash to Dockerfile * Print node env * Avoid test failure by not using ampersand HTML entity * Fix mixed JS/coffeescript (Erdbeere) * Build assets in CI/CD using test env * Don't explicitly specify NODE_ENV * Try to also set database url to empty string * Try to not init Rails app during asset precompilation * Unify database adapter env variables * Use new env variable in all places * Don't use vite_image_tag for email attachment urls * Use autobuild for tests such that RSpec tests work * Use Vite Dev Server also for local tests * Don't use anonymous volume for public folder in tests * Remove webpacker env variable * Fix rspec mampf container start (watch for exception) * Don't use any extra volume for public folder since the /usr/src/app is already mounted * Try again to create an anonymous volume for `public/` * Remove clicker-related views, routes, and associated tests - Deleted views related to clicker alternatives, actions, question previews, results, and layouts. - Removed clicker-related JavaScript files and their functionality. - Eliminated routes associated with clickers, including opening, closing, and associating questions. - Deleted clicker and clicker vote factories and their respective tests. - Cleaned up locale files by removing clicker-related translations. - Updated media search forms to remove clicker references. * Remove Clicker and ClickerVote models and associated relationships from User model * Remove clickers and clicker_votes tables with irreversible migration * Merge branch 'next' into features/remove-clickers * Remove unwanted space * Use simpler migration timestamp * Remove unused select_question method from Medium class * Update schema to most recent version --------- Co-authored-by: Splines <[email protected]>
* Update Rails dependency to 8.0.2 * Perform update via `bin/rails app:update` & manually review * Fix load defaults version * Upgrade schema file * Remove cache control header for test environment (since we don't cache there anyways) * Fix RuboCop errors (mainly new `params.expect()` unsafe autocorrects) * Patch Devise for Rails 8 See heartcombo/devise#5728 (comment) * Fix incorrect array syntax in params * Don't require an array for quizzes * Remove array for question_attributes in vignettes * Use permit for structure_params & remove unused comment_params * Expect lecture updates to fail (due to params being stricter) * Fix invalid syntax for course controller * Fix vignette @answers=nil error during preview * Fix missing `basics.division` translation * Permit `ValidationContext` class in `YAML.safe_load()` This is because Psych got stricter about which classes can be deserialized for security reasons. Maybe related: https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017 * Remove duplicate config line * Remove webpacker and sass-rails & add basic vite_rails config See this blog post by the creator of vite-rails: https://maximomussini.com/posts/a-rubyist-guide-to-vite-js#getting-started I've added the vite_rails gem, installed it, then ran: bundle exec vite install (Note that I removed the app/javascript folder beforehand, only locally, as we don't need it.) This is to get a basic setup. Nothing is expected to work at this moment. * Move vite_client_tag to global _head file (since this file is referenced also from other layout files) * Init basic bootstrap setup See the Bootstrap&Vite guide here: https://getbootstrap.com/docs/5.3/getting-started/vite/#configure-vite * Remove webpack-dev-server * Use jquery with Vite (remove Ruby gem) According to this post: https://dev.to/chmich/setup-jquery-on-vite-598k * Remove Sprockets (first migration step) See https://github.com/rails/propshaft/blob/main/UPGRADING.md#3-migrate-from-sprockets-to-propshaft Did not yet replace all asset_helpers (`image_url`, `font_url`) with standard `url`s. And did also not include Propshaft since I want to see what Vite can do for us first. Maybe we don't even need Propshaft after all? * Delete webpacker configuration 🥳 * Revert "Remove Sprockets (first migration step)" This reverts commit c8567a5. * Remove empty API assets (legacy) * Move stylesheets from `app/assets/stylesheets` to `app/frontend/entrypoints` Later, those shouldn't be global stylesheets anymore as this is heavily polluting. * Remove jquery-ui (not to confuse with jQuery itself) Didn't find out where it was needed... * Use Vite tag helpers Performed auto-replacing: `stylesheet_link_tag` ->`vite_stylesheet_tag` `javascript_include_tag` -> `vite_javascript_tag` See also: https://vite-ruby.netlify.app/guide/rails.html#tag-helpers-%F0%9F%8F%B7 * Remove old `app/javascript` folder (and move code to `application.js`) * Fix Bootstrap SCSS imports * Add back in bootstrap_form gem * Move stylesheets to subfolder (we add this subfolder as Vite entrypoint as well) * Fix no default import of `friendly-challenge` * Update vite_stylesheet_tag subfolder & use explicit file endings (the latter is for better performance) * Place javascript files in frontend folder * Add back in rails-sass only for sprockets pipeline * Correct vite_javascript_tag paths for subfolder usage (add `js/` at beginning) * Use vite_image_tag instead of image_tag & correct paths This has to be revised again as I'm not sure yet how vite_image_tag deals with absolute URLs passed to it. For commontator, we have to leave `image_tag`, such that the sprockets assets pipeline is used. * Convert sprocket requires to js imports * Use "~/" instead of "@/" Looks nicer and helps to distinguish from @npm packages * Add coffeescript Vite plugin & fix js imports * Use image_tag for urls & add missing .scss file extension * Include all bootstrap stylesheets * Fix CSS url path * Fix fonts path * Remove console.log * Configure Vite in Docker Compose * Load coffee plugin first to then inject JQuery * Use turbolinks npm package instead of gem * Init fixing JS reference errors by using new ES6 import syntax * Fix masonry & bootstrap/jquery issues * Rework einstein tiles p5 code for modern JS * Bring back public assets to respective folder * Rework Thyme-related JS files * Globally define `initBootstrapPopovers` * Remove coffeescript Rails gem * Also initialize bootstrap popovers on page load * Import bootstrap Toast for feedback JS * Ignore SASS legacy API warnings * Add back in missing p5 dependency * Setup js_routes for use with Vite * Remove webpack-related npm packages * Remove core-js dependency Just including it does nothing and there is no occurrence in our code for it. Therefore, we can just as well get rid of it. As we don't even use some very advanced, modern JS features, a polyfill is likely not really necessary. Should we find some weird browser behavior, it's easy to get back to it. * Remove regenerator-runtime The project is archived and I don't see why it was necessary to use it in the first place. * Remove coffeescript dependency * Remove console.logs() * Use production rails env for CI_CD asset bundling * Don't import Thyme-related components everywhere * Add back in coffee-rails * Add in Rails UJS (before migration to Turbo) * Use window-scope for reloadUrl helper function * Fix bootstrap stylesheet import in emails * Add just command to simulate Vite production build (currently without the output from Sprockets) * Remove accidentally commited mampf_routes * Use Sprocket pipeline for Commontator & Thredded assets * Add back in devise-bootstrap-views Also fix minor inconsistencies on signup page * Lint vite config & add back in Node globals to ESLint * Remove sass-loader dependency * Remove clicker sprocket syntax This will break the clicker functionality, but as discussed recently, this functionality is not used anyways anymore and we will get rid of clickers entirely in the future. * Fix geogebra assets inclusion * Fix missing Category import * Fix line too long * Fix talks.coffee -> talke.js & group according to JS/coffee * Configure vite for tests * Align test with dev Ruby environment * Remove premailer rails It doesn't work with vite. We might have to rework our mails styling afterwards. Or might want to integrate it again according to this: - fphilipe/premailer-rails#261 - ElMassimo/vite_ruby#93 (comment) * Fix vite ruby host * Fix js-routes issues due to multiple recompiling * Only recompile js-routes once at container start * Fix lectures people select spec * Use Turbolinks as Ruby Gem again We include it globally via the Sprockets asset pipeline. * Fix setSelectedRange on undefined bug (when the trix editor is not on the page) * Fix new lecture specs * Fix annotations overview tests * Fix commontator JS calling * Don't manually set NODE_ENV in entrypoint script * Add missing backslash to Dockerfile * Print node env * Avoid test failure by not using ampersand HTML entity * Fix mixed JS/coffeescript (Erdbeere) * Build assets in CI/CD using test env * Don't explicitly specify NODE_ENV * Try to also set database url to empty string * Try to not init Rails app during asset precompilation * Unify database adapter env variables * Use new env variable in all places * Don't use vite_image_tag for email attachment urls * Use autobuild for tests such that RSpec tests work * Use Vite Dev Server also for local tests * Don't use anonymous volume for public folder in tests * Remove webpacker env variable * Fix rspec mampf container start (watch for exception) * Don't use any extra volume for public folder since the /usr/src/app is already mounted * Try again to create an anonymous volume for `public/` * Refactor interactions: remove export_interactions functionality and related code * Remove interactions functionality and related code * Remove study participant references from quizzes and related views * Remove interactions table and related columns from probes and users * Remove commented-out remark_details method and related code from QuizRound * Rename session_id to attempt_token across models, views, and factories * Fix typo Co-authored-by: Copilot <[email protected]> * Remove PR-unrelated space * Rework migration timestamps * Apply change from next branch (The vite_image_tag is not applicable here) * Remove unnecessary top-level comment * Initialize attempt_token with a unique identifier in progress_counter method * Add index on attempt_token and correct columns in probes table * Refactor probe success calculation to use a transaction and prevent race conditions * Revert "Refactor probe success calculation to use a transaction and prevent race conditions" This reverts commit d6b465e. --------- Co-authored-by: Splines <[email protected]> Co-authored-by: Copilot <[email protected]>
Hi ! Thanks for the great work with vite_ruby ⚡
I was looking into integrating it into my app but got blocked because of premailer
Premailer needs to read and parse a CSS file to be able to inline it properly. Obviously it doesn't work when the dev server is enabled as it expects a classic css file and not ESM.
This PR is a total draft / POC, it aims at being able to skip the vite server, and grab a compiled file when we want to, basically force the on demand behaviour even when the dev server is running.
The wording is very bad,
force_build
isn't correct and should be changed if this goes further than this draft.I just wanted to get your opinion on this, do you see this as something that could make its way into the codebase (if re-done properly obviously), are there any gotchas I didn't see ?
Here is what I had to do :
Thanks !