npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

headmin

v0.6.3

Published

Admin component library

Downloads

146

Readme

Headmin

A complete library of commonly used components to build an admin interface in your Ruby on Rails project.

Gem Version npm version Test suite

Installation

To install Headmin into your current Rails application use bundler:

$ bundle add 'headmin'

Usage

All assets are available via the asset pipeline and can be called as if it was available in your application.

Stylesheets

Import all SCSS stylesheets like this:

@import "headmin";
  • Asset Pipeline: Sprockets & sassc-rails will pickup the correct file automatically
  • Node: Use a build tool like ESBuild, Webpack or Rollup to find the right file via Headmins' package.json

Javascript

Import the Headmin class into your script and initialize it. This will append its Stimulus controllers to the window.Stimulus object if it's available.

import {Headmin} from 'headmin'
Headmin.start()

Node or not to Node

With the introduction of importmap in Rails 7, you're no longer required to use node for your frontend assets. By default all assets are available via the asset pipeline and added to the default importmap.rb.

If you want to use node because you're tied to a specific build tool, you can add Headmin as a dependency to your package.json.

$ yarn add headmin

Helpers

Add the Headmin helpers to your helper file. We recommend using namespaces.

# In a, preferably namespaced, view helper
module AdminHelper
  include Headmin::AdminHelper
end

Development

For development purposes it's helpful to have both the test project and Headmin located in the same directory.

In Gemfile

gem "headmin", path: "../headmin"

In package.json

{
  "dependencies": {
    "headmin": "link:../headmin"
  }
}

To see frontend changes update live in development run

# Watches changes and builds them on-the-fly
yarn dev

Javascript

When adding new dependencies, make sure you add them to the package.json file as well as the importmap.rb file.

Testing

Run tests with

rake test

If you want to test a specific feature in a staging environment without releasing the gem, you can refer to the remote repo in your Gemfile and package.json.

In Gemfile

gem 'headmin', git: '[email protected]:insiting/headmin.git', branch: 'feature/test'

In package.json

{
  "dependencies": {
    "headmin": "ssh://[email protected]:insiting/headmin.git#feature\/test"
  }
}

Releasing

After integration a new feature of fixing a bug, first commit and push your changes.

Update the gem

# First bundle if new runtime dependencies were added
$ bundle

# Update the version number, push commits and tag the release
$ gem bump -v {patch,minor,major,...} --push --tag

# Release to Rubygems and create a Github release tag
$ gem release --github

Update the node package

# Manually update the version number in package.json
$ yarn build 
$ npm publish 

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/headmin. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Headmin project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.