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

coc-scssmodules

v0.2.2

Published

css and scss modules autocompletion and go-to-definition coc.nvim plugin and hopefully supporting sass parent selectors

Downloads

9

Readme

Deprecation Notice

[email protected] has implemented support for parent selectors so this extension is no longer required. It is recommended to use coc-cssmodules instead going forward.

coc-scssmodules

coc.nvim extension for autocompletion and go-to-definition functionality for CSS Modules.

Example showcasing autocompletion and go-to-defintion

Note: If you have coc-tsserver installed, the go-to-defininition might show a popup instead linking to type definition for *.module.s?css instead. You'll just need to select the .css file for this case since I don't know how to fix it.

Installation

:CocInstall coc-scssmodules

If you are using vim's plugin manager for coc-extensions, here's an example with vim-plug:

Plug 'mlaursen/coc-scssmodules', {'do': 'yarn install && yarn build'}

Configuration

This extension supports two configuration properties:

{
  "cssmodules.camelCase": {
    "type": ["boolean", "string"],
    "enum": [true, false, "dashes"],
    "default": false,
    "description": "Boolean if the suggestions should be converted to camelCase if you use kebab-case in css files. Should also work with sass parent selectors"
  },
  "cssmodules.hintMessage": {
    "type": "string",
    "default": "string (cssmodule)",
    "description": "The hint message to display next to an autocomplete suggestion from a css module"
  }
}

Acknowledgements

This extension is essentially a port of vscode-css-modules-plugin and coc-cssmodules.

Differences with coc-cssmodules (before v1.1.0)

The main reason I created this implementation was to support parent selectors within scss since I still like BEM for describing different states. If parent selectors (&) are not a concern, you should use the "official" coc-cssmodules instead.

Another small difference is that the configuration will be correctly typed when using :CocConfig and show warnings when the camelCase option is valid or invalid. (This could get ported into the "official" module as well though)

Finally, there is another configuration setting that can be used to show hint details when the autocompletion items if you do not like the default value of string (cssmodule).

TODO

Need to look into a way to actually write tests for this. None of the other coc-* extensions have tests right now, so nothing really to reference. I could write some tests for the utils and regexp at least.

Look into overriding/changing the coc-tsserver plugin for go-to-definitions so this one is the "default" so it doesn't require a selection.

Developing

Since I don't know a way to write automated tests yet with coc.nvim, the best way to do this is:

  • start the build watcher with yarn build -w
  • update your .vimrc to disable/remove the downloaded coc-scssmodules and use a local path with something like vim-plug to open up one of the test files within the test
    Plug '~/path/to/this-repo'
  • open up one of the test files in test
  • open up the log with :CocOpenLog
  • use the provided this.logger to log with this.logger.info
  • whenever you make a change, run :CocRestart and :CocOpenLog to see changes

It's pretty ugly.