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

wd-server

v1.0.9

Published

wd-server 是一个轻量的Web Server。支持LESS解析和简单的模板继承。

Downloads

27

Readme

wd-server 是一个轻量的Web Server。支持LESS(SASS、Stylus什么的,等后续吧。。。)解析、支持简单的模板继承。

wd-server 的目的在于简化前端开发环境。支持LESS解析、 模板机制(是的,还支持继承,你不必把页头反复考来考去了)。但有以下 几点需要注意:

  1. LESS中import强制改为绝对路径。基于根目录的 cssLib。该目录发布时会被忽略。
  2. wd-server 会禁用浏览器缓存,这样文件修改后不必修改版本号,方便手机端开发

安装

安装wd-server之前,请安装Nodejs环境

$ sudo npm install wd-server -g

如在windows下安装,请"以管理员身份运行"命令行窗口后操作。

创建项目

$ cd ~/project/site
$ wd-server create

$ wd-server create -d ~/project/site

下载示例站点

如果通过create命令安装失败,可手动下载。

git clone https://github.com/wheasy/wd-server-example.git

如果没有git,可直接下载源码。

启动服务

假设站点根目录位于 ~/project/site

在站点根目录启动

$ cd ~/project/site
$ wd-server

在任意位置启动站点,并指定端口号

$ wd-server -d ~/project/site -p 8080

如端口号被占用,wd-server 会自动尝试在原端口上加1后启动。

目录结构

wd-server有三个特殊文件(夹)

名称|说明 ----|---- blocks| 模板存放目录 cssLib| LESS文件存放目录 .wdsvr |可通过该文件配置wd-server

wd-server 默认不会显示这三个文件

发布

你可以通过 wd-server build发布站点,发布后不包括 blockless文件。

默认会发布到站点根目录的 _build目录,也可通过参数 r指定目录。

wd-server build [d] [r]

  • d 站点根目录
  • r 要发布的目录,相对路径或绝对路径
$ wd-server build -d ~/project/site -r ~/project/site-build

发布时,如需要屏蔽部分文件,可在.wdsvrbuild_ignore字段配置,支持字符串和正则

###.wdsvr 详解

改文件位于站点根目录,JSON格式,可通过它配置服务。

默认端口号为8180

wd-server 内置了常见mime,需要补充时,可通过mime添加

{
    // 端口号
    "port": 8180,
    // 是否压缩JS和CSS
    "comporess": true,
    // 全局变量
    "globalData":{
        // 版本号
        "ver": "20160325165232"
    },
    // 是否使用模块引用,默认为true
    "enableBlock": false
    // 自带模板的开始标记,默认是<%
    "openTag":"<?",
    // 自带模板的结束标记,默认是%>
    "closeTag":"?>",
    // 忽略文件,目录索引和发布时会忽略以下文件
    "ignore": [
        ".DS_Store", 
        "blocks", 
        "less", 
        ".git", 
        ".svn", 
        ".npm", 
        "server.sh", 
        "server.bat"
    ],
    mime:{
        "html": "text/html"
        ......
    }
}

在配置文件中指定globalData后,在页面中可以通过$g引用,如:

    <link rel="stylesheet" href="/css/home.css?v=<%$g.ver%>"/>

如需要指定端口号,可在启动时通过参数p指定。

答疑

如有疑问或建议,请在这里上留言。或加入QQ群:370792320