Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,11 @@ node_modules
.vite
# Ignore local Active Storage
storage

# Vite Ruby
/public/vite*
node_modules
# Vite uses dotenv and suggests to ignore local-only env files. See
# https://vitejs.dev/guide/env-and-mode.html#env-files
*.local

12 changes: 12 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@

Visit the guide for more information: https://vite-ruby.netlify.app/guide/rails
-->
<%= vite_client_tag %>
<%= vite_javascript_tag 'application' %>
<!--
If using a TypeScript entrypoint file:
vite_typescript_tag 'application'

If using a .jsx or .tsx entrypoint, add the extension:
vite_javascript_tag 'application.jsx'

Visit the guide for more information: https://vite-ruby.netlify.app/guide/rails
-->

</head>
<body
class="
Expand Down
9 changes: 9 additions & 0 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# Allow @vite/client to hot reload javascript changes in development
# policy.script_src *policy.script_src, :unsafe_eval, "http://#{ ViteRuby.config.host_with_port }" if Rails.env.development?

# You may need to enable this in production as well depending on your setup.
# policy.script_src *policy.script_src, :blob if Rails.env.test?

# policy.style_src :self, :https
# Allow @vite/client to hot reload style changes in development
# policy.style_src *policy.style_src, :unsafe_inline if Rails.env.development?

# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"devDependencies": {
"vite": "^5.4.20",
"vite": "^5.4.21",
"vite-plugin-ruby": "^5.1.1"
},
"dependencies": {
Expand Down
11 changes: 2 additions & 9 deletions vite.config.mts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { defineConfig } from 'vite'
import RailsPlugin from 'vite-plugin-rails'
import tailwindcss from '@tailwindcss/vite'
import RubyPlugin from 'vite-plugin-ruby'

export default defineConfig({
plugins: [
tailwindcss(),
RailsPlugin({
envVars: { RAILS_ENV: "development" }
}),
RubyPlugin(),
],
server: {
allowedHosts: ["localhost", "vite"],
}
})