From dfea1f1183547f2b726f03b9eb99e5fb82f4c4f1 Mon Sep 17 00:00:00 2001 From: Dean Lofts Date: Tue, 3 Sep 2024 23:32:43 +1000 Subject: [PATCH 1/2] temp fix --- app/assets/config/manifest.js | 3 +-- app/assets/stylesheets/application.css | 7 +++++++ app/assets/stylesheets/application.css.scss | 1 + app/javascript/entrypoints/application.js | 1 + app/views/layouts/application.html.erb | 1 + config/application.rb | 2 ++ config/initializers/assets.rb | 3 +++ config/tailwind.config.js | 2 +- vite.config.mts | 11 ++++++----- 9 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 app/assets/stylesheets/application.css.scss diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index b06fc42..ffbd8c0 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,5 +1,4 @@ //= link_tree ../images //= link_directory ../stylesheets .css //= link_tree ../../javascript .js -//= link_tree ../../../vendor/javascript .js -//= link_tree ../builds +//= link_tree ../../../vendor/javascript .js \ No newline at end of file diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index b629f51..f8eccf3 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,3 +1,10 @@ +/* +*= require font_awesome_import +*= require font-awesome +*= require_self +*= require_tree . +*/ + @keyframes rainbow-pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss new file mode 100644 index 0000000..0fa9e6f --- /dev/null +++ b/app/assets/stylesheets/application.css.scss @@ -0,0 +1 @@ +@import "font-awesome"; \ No newline at end of file diff --git a/app/javascript/entrypoints/application.js b/app/javascript/entrypoints/application.js index 2d3ab6a..8c6a60b 100644 --- a/app/javascript/entrypoints/application.js +++ b/app/javascript/entrypoints/application.js @@ -3,6 +3,7 @@ import "chartkick/chart.js"; import "flowbite"; import "../../assets/stylesheets/application.css"; +import '../../assets/stylesheets/application.css.scss' import "../../assets/stylesheets/application.tailwind.css"; Rails.start(); diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index bf86a98..c92b84d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,6 +10,7 @@ <%= vite_client_tag %> <%= vite_javascript_tag 'application' %> + <%= tag.meta property: 'og:type', content: 'website' %> diff --git a/config/application.rb b/config/application.rb index f28b3f7..0421c52 100644 --- a/config/application.rb +++ b/config/application.rb @@ -18,6 +18,8 @@ class Application < Rails::Application config.middleware.use PageViewTracker + # config.assets.paths << Rails.root.join("node_modules") + # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 2eeef96..50eeba8 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -10,3 +10,6 @@ # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. # Rails.application.config.assets.precompile += %w( admin.js admin.css ) + +Rails.application.config.assets.precompile += %w( *.scss ) +Rails.application.config.assets.precompile += %w( application.css.scss ) \ No newline at end of file diff --git a/config/tailwind.config.js b/config/tailwind.config.js index a02bd93..9aba9bf 100644 --- a/config/tailwind.config.js +++ b/config/tailwind.config.js @@ -8,7 +8,7 @@ module.exports = { './app/javascript/**/*.js', './app/views/**/*.{erb,haml,html,slim}', './node_modules/flowbite/**/*.js', - './app/assets/stylesheets/**/*.css', + './app/assets/stylesheets/**/*.{css,scss}', ], theme: { extend: { diff --git a/vite.config.mts b/vite.config.mts index 935e922..ac13655 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -9,7 +9,7 @@ export default defineConfig({ build: { rollupOptions: { input: { - application: 'app/javascript/entrypoints/application.js' // Path to your main JS entry point + application: 'app/javascript/entrypoints/application.js' } }, }, @@ -17,11 +17,12 @@ export default defineConfig({ preprocessorOptions: { scss: { includePaths: [ - path.resolve(__dirname, 'node_modules'), // Ensure Vite looks in node_modules for styles - path.resolve(__dirname, 'app/assets/stylesheets') // Include your stylesheets directory + path.resolve(__dirname, 'node_modules'), + path.resolve(__dirname, 'app/assets/stylesheets') ], + // Remove the additionalData line that was causing the circular import }, }, }, - assetsInclude: ['**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.svg'] // Include any other assets you want to be processed -}); + assetsInclude: ['**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.svg', '**/*.eot', '**/*.ttf', '**/*.woff', '**/*.woff2'] +}); \ No newline at end of file From 15efa9069542bc372b559e1f91595cd8237f578d Mon Sep 17 00:00:00 2001 From: Dean Lofts Date: Tue, 3 Sep 2024 23:36:28 +1000 Subject: [PATCH 2/2] temp fix --- app/assets/config/manifest.js | 5 +++-- app/assets/stylesheets/application.css | 7 ------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index ffbd8c0..07677ae 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,4 +1,5 @@ //= link_tree ../images -//= link_directory ../stylesheets .css +//= link_directory ../stylesheets .scss //= link_tree ../../javascript .js -//= link_tree ../../../vendor/javascript .js \ No newline at end of file +//= link_tree ../../../vendor/javascript .js +//= link application.css \ No newline at end of file diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index f8eccf3..b629f51 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,10 +1,3 @@ -/* -*= require font_awesome_import -*= require font-awesome -*= require_self -*= require_tree . -*/ - @keyframes rainbow-pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; }