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

ng2-fused

v0.5.1

Published

FuseBox plugins and utilities for building Angular2 applications.

Downloads

46

Readme

ng2-fused

FuseBox plugins and utilities for building Angular2 applications. Templating, Lazy Loaded Modules, and Spec Bundle support.

Installation

npm install ng2-fused --save-dev

NPM

Check out the ng2-fused-seed project for a working starter project utilizing the following plugins.

Ng2TemplatePlugin

Wraps url strings for templateUrl and styleUrls inside of require statements. Inspired by angular2-template-loader for webpack.

Usage

Just call the Ng2TemplatePlugin() within the FuseBox plugins array.

You should also use the RawPlugin so that the imported stylesheet gets exported as a text string.

const { FuseBox } = require('fuse-box');
const { Ng2TemplatePlugin } = require('ng2-fused');

const fuse = FuseBox.init({
    homeDir: './src',
    plugins: [
        Ng2TemplatePlugin(),
        ['*.component.html', RawPlugin()],
        ['*.component.css', RawPlugin()]
     //   or with a css pre/post processor...
     // ['*.component.css', PostCss([precss()]), RawPlugin()]   
    ]
});

...

fuse.run();

Before Transform...

@Component({
    selector: 'my-component',
    templateUrl: './my.component.html',
    styleUrls: ['./my.component.css']
})
export class MyComponent {}

After Transform...

@Component({
    selector: 'my-component',
    template: require('./my.component.html'),
    styles: [require('./my.component.css')]
})
export class MyComponent {}

Options

You can tweak the plugin with the following options:

plugins: [
    Ng2TemplatePlugin({ ignoreStyleUrls: true })
]

Ng2RouterPlugin

** O.5 Breaking Changes ** - Version 0.5 changed the behaviour of this plugin to better work for both JIT and AOT builds.

Converts Angular2 lazy loaded routes within loadChildren properties utilize a custom NgModuleFactoryLoader that works with FuseBox bundles (even ones bundled with the Quantum plugin). Also has a utility that will automatically configure FuseBox to automatically code split modules based on folder naming conventions (module folders beginning with "+"). Inspired by angular2-router-loader for webpack.

Usage

The plugin should be configured as a top level plugin.

const { FuseBox } = require('fuse-box');
const { Ng2RouterPlugin } = require('ng2-fused');

const fuse = FuseBox.init({
    homeDir: './src',
    plugins: [
        Ng2RouterPlugin({ 
            aot: config.aot,
            autoSplitBundle: 'app',
            vendorBundle: 'vendors'
        })      
    ]
});

...

fuse.run();

Options

You can tweak the plugin with the following options:

Issues...

Currently the switching between AOT and JIT sometimes causes issues when FuxeBox's cache is used. As a workaround, when a build is executed, the cache folder is first deleted.

Ng2SpecBundlePlugin

This plugin allows for the creation of a spec bundle file that imports all spec files found in the project. This is more so required if using the QuantumPlugin. It should be used as a plugin for ONLY the bundle that the specs should be provided in.

fuse.bundle('app')
    .plugin(Ng2SpecBundlePlugin())
    ...

By default this plugin tests for the file /spec-bundle\.(ts|js)$/, if you wish for your spec bundle file to be named something different then you'll have to change this.

Options

Roadmap

  • Auto import of html and css for components if files are found in folder structure.
  • More unit tests.
  • More samples.

For a seed project utilizing FuseBox and Ng2Fused, check out https://github.com/alex-klock/ng2-fused-seed.