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

taro-page-plugin

v0.0.1

Published

Taro 页面生成插件

Downloads

1

Readme

taro-page-plugin

Taro 生成页面/组件生成插件

安装

在 Taro 项目根目录下安装

$ npm i taro-page-plugin --save

使用

引入插件

修改项目 config/index.js 中的 plugins 配置为如下

const config = {
  ...
  plugins: [
    ...其余插件

    ['taro-page-plugin',{
       css:'scss',// 默认 scss
       version: 3// taro 版本默认 3
    }]
  ]
  ...
}

插件配置

taro-page-plugin 插件支持以下参数

| 参数项 | 类型 | 是否可选 | 用途 | 默认值 | | :--------- | :----- | :------- | :----------------------------------------------------- | :----- | | css | string | 是 | 指定 css 类型,可选择 none,sass,less, | scss | | version | number | 是 | 指定 Taro 版本,可选 2、3, | 3|

这样可通过 taro template 参数 来自动化创建页面

命令行参数

taro-page-plugin 插件支持以下参数

| 参数项 | 类型 | 是否可选 | 用途 | | :---------- | :----- | :------- | :---------------------- | | --component | string | 是 | 创建一个组件/页面级组件 | | --page | string | 是 | 创建一个页面 | | --subpackages | string | 是 | 创建一个页面 |

使用案例

1.创建项目组件
 taro template --component Button

生成结果:

-- 组件:      components/Button/Button.tsx
-- 组件样式:  components/Button/Button.scss
2.创建页面组件
 taro template --component index/Button  // index为页面文件夹名称,自动生成为 pages/index

生成结果:

-- 组件:      pages/index/components/Button/Button.tsx
-- 组件样式:  pages/index/components/Button/Button.less
3.创建页面
 taro template --page/subpackages Detail

生成结果:

-- 页面:          pages | subpackages /Detail/Detail.tsx
-- 页面配置:       pages | subpackages /Detail/Detail.config.tsx
-- 页面样式:      pages | subpackages /Detail/Detail.scss
4.创建页面(指定具体页面名称)
 taro template --page/subpackages index/search

生成结果:

-- 页面:          pages | subpackages/index/search.tsx
-- 页面配置:       pages | subpackages/index/search.config.tsx
-- 页面样式:       pages | subpackages/index/search.less