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

slush-react-builder

v0.1.8

Published

A Slush generator for ES6 React components that creates a .jsx file and a .scss (or css, less, stylus etc) file at a specified path.

Downloads

3

Readme

slush-react-builder

A Slush generator for ES6 React components that creates a .jsx file and a .scss (or css, less, stylus etc) file at a specified path.

This generator assumes a modular development style using Webpack* with jsx and style files living along side each other in one directory.

Defaults templates are provided but can be overriden on a per project basis.

*Or any other build tool that allows style files to be required within JavaScript files.

Installation

Slush templates need to be installed globally, which usually means prefixing the line below with a sudo.

npm install -g slush-react-builder

Usage

WARNING: Conflict resolution is on the roadmap but not yet implemented. If new components are generated in the same location as existing ones, older files will overrwritten

First navigate to the root of your project.

Component names by convention

Naming can be done by convention, where a capitalized version of the last segment of the path will be used as the component and style file name.

$ slush react-builder:component src/client/components/mapView

Creates:

  • src/client/components/mapView/MapView.jsx
  • src/client/components/mapView/MapView.scss

Component names by configuration

If more control is required over naming, a file name may also be be specified.

$ slush react-builder:component src/client/components/mapView SpecialMapView

Creates:

  • src/client/components/mapView/SpecialMapView.jsx
  • src/client/components/mapView/SpecialMapView.scss

Templates

Default templates

The following templates are provided by default.

JSX (.jsx)

import React from 'react';

require('./MapView.scss');

export default class MapView extends React.Component; {

  constructor(props) {
    super(props);
  }

  render() {
    return (
      <div className="MapView"></div>
    );
  }

}

Sass (.scss)

.MapView {
}

Overriding templates

If you'd prefer a different jsx or style template, add a slushconfig.js to your application root:

module.exports = {
  "templateDirectoryPath": "./mySlushTemplates",
  "styleFileExtension": "css"
}

|Property | Description| |:--- |:---| | templateDirectoryPath | The directory containing the templates. | | styleFileExtension | The extension of the style file - e.g. scss/less/css etc. |

For the example above the directory structure should be as follows:

-myProjectRoot
    - mySlushTemplates
        - component
            - Component.jsx
            - Style.css

Roadmap