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

ng-custom-templates

v0.0.5

Published

A development environment utility that makes it easy to use custom templates in Angular JS.

Downloads

8

Readme

License: MIT npm: 6.12.0 GitHub release English Korea

ngCustomTemplates

A development environment utility that makes it easy to use custom templates in Angular JS.

Install

$ npm i ng-custom-templates

Use

$ ng g ng-custom-templates:run [My Templates Name]

※ My Templates Name : You should create and use a template for each folder in the 'templates' folder.

Folder structure

[Before generating]

root
  |- e2e
  |- node_modules
  |- src                 <-- AngularJS source folder.
       |- app
  |- templates           <-- The folder you need to create!
       |- demo           <-- The templates to be used can be registered and used for each folder.

[Generating]

$ ng g ng-custom-templates:run demo

? Class Name (ex> CountryCode) :  CountryCode
? Page Title (ex> Country List) :  Country List
? Install Path :  /src/app
CREATE src/app/routes/country-code/country-code-routing.module.ts (218 bytes)
CREATE src/app/routes/country-code/country-code.module.ts (432 bytes)
CREATE src/app/routes/country-code/services/country-code.service.ts (161 bytes)

[After generating]

root
  |- e2e
  |- node_modules
  |- src
       |- app
            |- routes
                 |- country-code	<-- Generated folder
  |- templates
       |- demo

Conversion rules

Propertis of ngCustomTemplates

  • className : The property to convert to the user specified class name.
  • pageTitle : The property to convert to the user specified page name.

Usage - Folder & File

※ Rules of Use : __[PROPERTY_NAME]@[FUNCTION_NAME]__ ※ Apply to : Folder & File

[Before generating]

__className@dasherize                         <- folder
    |- [email protected]    <- files
    |- [email protected]
    |- [email protected]

[After generating]

country-code                                  <- folder
    |- country-code.component.css             <- files
    |- country-code.component.html
    |- country-code.component.js

Usage - Text in file

※ Rules of Use : <%= [FUNCTION_NAME]([PROPERTY_NAME]) %> ※ Apply to : Text in file

[Before generating]

export class <%= classify(className) %>Component {
  const <%= camelize(className) %>;
}

[After generating]

export class CountryCodeComponent {
 const countryCode;
}

※ You can use the same syntax in all files such as html and css.

Functions

※ classify : Returns the UpperCamelCase form of a string.

 classify('innerHTML');             // 'InnerHTML'
 classify('action_name');           // 'ActionName'
 classify('css-class-name');        // 'CssClassName'
 classify('my favorite items');     // 'MyFavoriteItems'

※ camelize : Returns the lowerCamelCase form of a string.

 camelize('innerHTML');             // 'innerHTML'
 camelize('action_name');           // 'actionName'
 camelize('css-class-name');        // 'cssClassName'
 camelize('my favorite items');     // 'myFavoriteItems'
 camelize('My Favorite Items');     // 'myFavoriteItems'

※ decamelize : Converts a camelized string into all lower case separated by underscores.

 decamelize('innerHTML');           // 'inner_html'
 decamelize('action_name');         // 'action_name'
 decamelize('css-class-name');      // 'css-class-name'
 decamelize('my favorite items');   // 'my favorite items'

※ dasherize : Replaces underscores, spaces, or camelCase with dashes.

 dasherize('innerHTML');            // 'inner-html'
 dasherize('action_name');          // 'action-name'
 dasherize('css-class-name');       // 'css-class-name'
 dasherize('my favorite items');    // 'my-favorite-items'

※ underscore : More general than decamelize. Returns the lower_case_and_underscored form of a string.

 underscore('innerHTML');           // 'inner_html'
 underscore('action_name');         // 'action_name'
 underscore('css-class-name');      // 'css_class_name'
 underscore('my favorite items');   // 'my_favorite_items'

※ capitalize : Returns the Capitalized form of a string.

 capitalize('innerHTML');           // 'InnerHTML'
 capitalize('action_name');         // 'Action_name'
 capitalize('css-class-name');      // 'Css-class-name'
 capitalize('my favorite items');   // 'My favorite items'

References

Total Guide To Custom Angular Schematics

Schematics: Building blocks