
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Easily create your own HTML/CSS/JS component library.
Add this line to your application's Gemfile:
gem 'component_library'
And then execute:
$ bundle
$ bundle exec rails generate component_library:install components
app/views/components/_icons.html.erb
)By default the component library will assume to use the application layout and CSS file (application.html.erb
& application.css
), in addition to some basic styles added by the gem itself. If you wish to override this feature and use a different stylesheet, change the root file path, or the url the library routes to, these can be configued inside an initializer.
ComponentLibrary.configure do |config|
config.application_css = "new_application_css"
config.root_path = "new_component_library"
config.root_directory = "new_view_directory"
end
If you want to use a totally different layout for your component library, simply create a new layout named component_library.html.erb
in your layouts directory and change there as appropriate.
It is possible to allow multiple instances of a component library to be created - for example if you wanted to use the same components, but test different stylesheets at different urls:
ComponentLibrary.configure do |config|
config.multiconfigure = [
{
root_directory: "theme_components",
root_path: "theme_1_components",
application_css: "theme_1_css"
},
{
root_directory: "theme_components",
root_path: "theme_2_components",
application_css: "theme_2_css"
}
]
end
Or if you want entirely different component libraries - for example a library for your public facing site, one for the admin section, and one for another part of your site...:
ComponentLibrary.configure do |config|
config.multiconfigure = [
{
root_directory: "public_components",
root_path: "public-components",
application_css: "application_css"
},
{
root_directory: "admin_components",
root_path: "admin-components",
application_css: "admin_css"
},
...
]
end
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that component_library demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.