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

creater

v1.0.16

Published

create file with config

Downloads

26

Readme

creater

English

介绍

creater 是一个用来定制化创建一个或一组文件

很多时候、创建文件需要默认内容、比如vue的默认结构、react的默认引入、

为了创建文件直接有内容而不是复制粘贴、这种时候、就可以用到creater、来定制化创建

也可以一次性创建多个同名文件且不同后缀的文件、一行命令即可使用

根据参数、你可以根据配置一次性生成多个同名且不同后缀的文件、

在项目中避免重复的create file、

包括内容也可以通过模版来统一配置、防止无限的复制粘贴

模版可以随意修改(这样每一个文件加入作者信息就不需要复制粘贴了)

npm install -g creater

gif loading...

快速开始

通过命令生成配置文件

creater init

takeTemplate?(Y/N)_ //输入Y开启模版功能、可以满足大部分定制化需求、具体的配置说明可以继续往下看

开始使用(执行):

creater new hello

或者

creater new hello.vue --simple

更多参数可以看这里

应用场景

例如你的结构是这样

my-app
  css
    hello.css
  js
    hello.js
  view
    hello.html
  utils
  index.html
  package.json
	

以hello为名的文件有三个、分布在三个不同的文件夹、只是后缀不一样、甚至可能每一个都有它独立的内容

这个时候creater可以大显身手、用来一次性创建这三个文件(当然根据配置也可以更多)、再根据自己的需求改造模版、把内部的默认代码一起生成了

比如index.html里面引入的公共js(jquery、bootstrap等)、写在模版里、就不需要每个生成的页面复制粘贴了

配置文件

| 参数 | 说明 | 备注/可选值 | |------------|-------------|-------------| | type | type是生成多个文件的配置选项|内部多个属性则多个文件| |type.xxx|type的属性名对应生成文件的后缀|唯一| |type.xxx.url|生成文件放入的文件夹|view/tw| |type.xxx.template|生成文件使用的模版(不设置此项则设置content)|template/index.html| |type.xxx.content|生成文件写入的默认内容(如果配置了模版则不用设置此项)|//2017-06-20| |simplepath|单文件生成模式路径|creater/simple| |content|单文件生成模式内容|//created by creater \n//2017-06-20|

启动命令

生成配置文件(也可以自己写)

creater init

可以查看使用new的帮助

creater new -h

单文件创建模式、路径取simplepath、内容取content

creater new test.vue --simple

//注意、simple模式下创建文件需要加扩展名、多文件模式下会自动取后缀名所以不需要加