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

generator-iced-react-webpack

v0.0.7

Published

Yeoman generator for Iced CoffeeScript, ReactJS and Webpack

Downloads

6

Readme

generator-iced-react-webpack Build Status Built with Grunt

Yeoman generator for ReactJS - lets you quickly set up a project including the Iced CoffeeScript language, karma test runner, and Webpack module system.

Fork Information

This is a form of generator-react-webpack. All credit for the majority of the code in this repository goes to Simon Bailey (newtriks)

Usage

Install generator-iced-react-webpack:

npm install -g generator-iced-react-webpack

Make a new directory, and cd into it:

mkdir my-new-project && cd $_

Run yo iced-react-webpack, optionally passing an app name:

yo iced-react-webpack [app-name]

Run grunt for building and grunt serve for preview in the browser at localhost.

Generators

Available generators:

Note: Generators are to be run from the root directory of your app.

App

Sets up a new ReactJS app, generating all the boilerplate you need to get started. The app generator also facilitates the following:

  1. Configures a Gruntfile to run the app on a local server.
  2. Configures Webpack to modularise the app enabling loading of various file formats e.g. JSON, CSS, PNG, etc.
  3. Configures Karma to run all tests.
  4. Watches for changes and recompiles JS and refreshes the browser.

Example:

yo iced-react-webpack

Component

Generates a JSX component in src/scripts/components and it's corresponding test in src/spec/components.

Example:

yo iced-react-webpack:component foo

Produces src/scripts/components/Foo.iced (iced coffeescript - JSX):

`/** @jsx React.DOM */`

'use strict'

var React = require 'react/addons'
require '../../styles/Foo.css'

Foo = React.createClass({
  render: ->
    `<div>
      <p>Content for Foo</p>
    </div>`

module.exports = Foo

And test/spec/components/Foo.coffee (coffeescript - jasmine):


'use strict'

describe '<%= classedName %>', ->
  beforeEach ->
    Foo = require '../../../src/scripts/components/<%= classedFileName %>.iced'
    component = do Foo

  it 'should create a new instance of <%= classedName %>', ->
    expect(component).toBeDefined()

And src/styles/Foo.css:


.Foo{
  border: 1px dashed #f00;
}

Testing

Running grunt test will run the unit tests with karma. Tests are written using Jasmine by default.

Further Information

Project Structure

The react-webpack generator automates the setup of a ReactJS project using the specific structure detailed below:

project
  - src
    - scripts
      -components
        ComponentOne.iced
        ComponentTwo.iced
      main.iced
    - styles
      main.css
      reset.css
    index.html
  - test
    - spec
      - components
        ComponentOne.coffee
        ComponentTwo.coffee
    - helpers
      - react
        addons.js
      phantomjs-shims.js
  Gruntfile.coffee
  karma.conf.coffee

I have tried to keep the project structure as simple as possible and understand it may not suit everyone.

Naming Components

I have opted to follow @floydophone convention of uppercase for component file naming e.g. Component.js. I am open to suggestions if there is a general objection to this decision.

Modules

Each component is a module and can be required using the Webpack module system. Webpack uses Loaders which means you can also require CSS and a host of other file types. Read the Webpack documentation to find out more.

Grunt

Out the box the Gruntfile is configured with the following:

  1. webpack: uses the grunt-webpack plugin to load all required modules and output to a single JS file src/scripts/main.js. This is included in the src/index.html file by default and will reload in the browser as and when it is recompiled.
  2. webpack-dev-server: uses the webpack-dev-server to watch for file changes and also serve the webpack app in development.
  3. connect: uses the grunt-connect plugin to start a webserver at localhost.
  4. karma: uses the grunt-karma plugin to load the Karma configuration file karma.conf.js located in the project root. This will run all tests using PhantomJS by default but supports many other browsers.

CSS

Included in the project is Eric Meyer's reset.css script. There is also a src/styles/main.css script that's required by the core src/scripts/components/App.js component using Webpack.

JSHint

Please use JSXHint for linting JSX and the corresponding Sublime package if using SLT3 SublimeLinter-jsxhint. Note this is a global npm install and JSX files will need to be associated with the JSX file type withing SLT3.

Props

Thanks to all who contributed to generator-angular as the majority of code here has been shamelessy sourced from that repos.

Thanks to Edd Hannay for his Webpack optimisations, my local merge and testing meant his additions lost his signature (my fault sorry) so big thanks Edd.

Contribute

Contributions are welcomed. When submitting a bugfix, write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix.

License

BSD license

Bitdeli Badge