sassc-rails | Integrate SassC-Ruby with Rails | Style Language library
kandi X-RAY | sassc-rails Summary
kandi X-RAY | sassc-rails Summary
We all love working with Sass, but compilation can take quite a long time for larger codebases. This gem integrates the C implementation of Sass, LibSass, into the asset pipeline.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sassc-rails
sassc-rails Key Features
sassc-rails Examples and Code Snippets
Community Discussions
Trending Discussions on sassc-rails
QUESTION
I am getting the following error zeitwerk/loader/helpers.rb:95:in const_get': uninitialized constant Controllers::BasePublicDecorator (NameError)
This is an error in a local production console using rails c -e production
but not an issue in development which works perfectly.
In an engine, CcsCms::PublicTheme
, I have a decorator I am using to extend the controller of another CcsCms::Core
engine and it is this decorator that is causing the error.
...public_theme/app/decorators/decorators/controllers/base_public_decorator.rb
ANSWER
Answered 2022-Apr-02 at 19:30Problem here is that when lazy loading, nobody is referencing a constant called ...::BasePublicDecorator
. However, Zeitwerk expects that constant to be defined in that file, and the mismatch is found when eager loading.
The solution is to configure the autoloader to ignore the decorators, because you are handling their loading, and because they do not define constants after their names. This documentation has an example. It needs to be adapted to your engine, but you'll see the idea.
For completeness, let me also explain that in Zeitwerk, eager loading is a recursive const_get
, not a recursive require
. This is to guarantee that if you access the constant, loading succeeds or fails consistently in both modes (and it is also a tad more efficient). Recursive const_get
still issues require
calls via Module#autoload
, and if you ran one for some file idempotence also applies, but Zeitwerk detects the expected constant is not defined anyway, which is an error condition.
QUESTION
So I have a file not found problem. I have an engine that works in development mode in the engines test/dummy app, the engine allows the editing of sass variables and stores them in a theme table, the variables are used by a sass partial such as _banner.scss containing variables used in the main stylesheet such as $banner_color which is then imported into the main stylesheet which in turn is precompiled using an initializer in the engine.rb file and inclusion in the app/config/engine_name_manifest.js.
The files are all available in development with the local dummy app but not in the eventual host app due to the assets being compiled.
I have a rake task that takes the data, updates the relevant partial e.g. _banner.scss with the data from the theme table but of course the partials are not not available in a host app as the engine has already compiled them. I'm looking for a solution that will allow me to edit the raw, uncompiled stylesheets then recompile them. Obviously my Capistrano deploy script will need to reapply the stylesheet changes every deployment but that is just a rake task call. What approach should I take? Should I find a way to copy the css files to the host app in an engine initializer? Should I use a different approach entirely, I have started looking at propshaft but that is a massive step to replace sass rails and I'm not sure how that would help
The engine
...ANSWER
Answered 2022-Apr-02 at 03:44Thanks for clarifying. If I understood correctly here my take on it.
partials are not not available in a host app as the engine has already compiled them
Partials are still there, precompilation just outputs *.{css/js}
files into public/assets/
that are declared in app/assets/config/manifest.js
.
To get to engines files, instead of Rails.root
use:
QUESTION
I have a Rails 7 project using TailwindCSS deployed to Heroku that is not building tailwind.css
during rake asset:precompile
and I don't know why. When I try to access the application, it crashes with this error:
ANSWER
Answered 2022-Mar-23 at 15:15Try running the following commands on your local machine:
QUESTION
I recently upgraded from Rails 6.1.4.6 to 7.0.2.2. With this upgrade I switched from webpacker to import maps with sprockets. My repo didn't include turbolinks or stimulus and I didn't feel like adding them now either. So I re-added UJS and most of my tests pass except the action cable feature tests. It seems I cannot get action cable to connect.
Any help would be appreciated!
Gemfile
...ANSWER
Answered 2022-Mar-09 at 22:08Figured out the problem was because I had two applications.js
files. One in app/assets/javascripts/
and another in app/javascript
. Sprockets was serving my asset version of application.js due to my manifest pointing there. I adjusted the manifest and deleted the secondary application.js and all is working.
QUESTION
I gen this error when I try to deploy:
...ANSWER
Answered 2022-Mar-05 at 11:54Tailwind CSS for Rails is not compatible with SassC::Rails:
Tailwind uses modern CSS features that are not recognized by the
sassc-rails
extension that was included by default in the Gemfile for Rails 6. In order to avoid any errors likeSassC::SyntaxError
, you must remove that gem from your Gemfile.
Remove sassc-rails
from your Gemfile
, run bundle
, commit the changes, and redeploy.
QUESTION
I'm working on getting a new Rails 7 project deployed to production (trying on both Heroku and Render.com) and am getting the following error during build:
...ANSWER
Answered 2021-Dec-18 at 05:58From rails tailwind readme
Tailwind uses modern CSS features that are not recognized by the sassc-rails extension that was included by default in the Gemfile for Rails 6. In order to avoid any errors like SassC::SyntaxError, you must remove that gem from your Gemfile.
QUESTION
I'm very new to Rails and full-stack development in general. I've just finished Michael Hartl's Ruby on Rails Tutorial 6th edition and am walking through it again to build my first project (i.e. an app that's different from the sample app built in the book, but draws on a lot of the same lessons). Catch is that new project is using Rails 7.
It was going well until I ran into issues around Chapter 7; my app will not render a partial with error messages for bad submissions to the new user form. The code in the partial executes (as verified with debugger, and later with a puts statement to output on console), but the HTML doesn't output (i.e. it cannot be found when inspecting the page in Chrome). There is a CSS issue related to newer version of bootstrap, but I even tried downgrading to the bootstrap version from the book (3.4.1) with no luck. (the offending CSS segment is commented out below)
I've banged my head on this for a few hours. Hoping it's just something dumb I'm missing. If it's a broader issue with Bootstrap vs Importmaps or something I'd also appreciate references on good places to learn these. I am extremely grateful for any ideas!
Edit This definitely isn't an issue with passing local variables into the partial; see code snippet and comment added at the end of this post.
app/views/users/new.html.erb:
...ANSWER
Answered 2022-Feb-14 at 02:28Try this in app/views/users/new.html.erb
<%= render 'shared/error_messages', user: @user %>
If it's a shared partial, maybe make the instance variable generic rather than @user
also. That way it can be reused and less confusing later.
QUESTION
I am learning Hotwire-rails, following both the gorails.com and the Hotwire.dev examples. I am running Ruby 3.0.2 and Rails 6.1.4.1. The symptom is at the very start. After rails new xxx, I edit Gemfile to add gem 'hotwire-rails', then bundle install. At this point my app/javascript/packs/application.js is now:
...ANSWER
Answered 2021-Nov-11 at 12:27This seems like everything is working correctly rails just likes to output what its doing to the console but it should have added those to your file.
QUESTION
I have a new rails 7 application which is using the importmap-rails
gem to manage the javascript frontend libraries.
I am attempting to use the Semantic-UI library, but the dependency for jQuery is not being recognized by the Semantic-UI javascript.
I was unable to pin the Semantic-UI library via importmap, so I added this library to the importmap.rb
manually. Here is a link the cdn for semantic.min.js I am using.
The following error message appears in the console on Chrome Web Tools and the collapsible accordions are not functioning that I have on the page to validate the javascript.
...ANSWER
Answered 2022-Jan-10 at 19:11I resolved this issue by manually updating the source for jquery pinned in importmap.rb
from the source that the original bin/importmap pin jquery
pointed at which was:
https://ga.jspm.io/npm:jquery@3.6.0/dist/jquery.js
to now be
https://code.jquery.com/jquery-3.6.0.min.js
Additionally, I added some jquery code to application.js
to run when the document is loaded (per the documentation on Semantic-UI's website
QUESTION
So after executing the following commands:
rails new sample_app
cd sample_app
rails db:create
rails generate scaffold User name:string email:string
rails db:migrate
and finaly when i run rails server
i get:
ANSWER
Answered 2021-Aug-02 at 08:30I think you need a webpacker.yml
file in your apps config
file. I also suggest running bundle install
and bundle update
commands before launching the rails server after you installed a gem. Here's a closed issue similar to your problem; https://github.com/rails/webpacker/issues/940
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sassc-rails
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page