0.3.28 • Published 8 years ago

nodewebx-server-lite v0.3.28

Weekly downloads
3
License
MIT
Repository
gitlab
Last release
8 years ago

nodewebx-server


Usage

nodewebx server

LESS使用

version: >= 0.3.11 开始支持

在项目里面只用写less文件,模板里面直接引用.css路径(该文件不需要存在,nodewebx会 根据找该css路径下同名文件的less并编译返回)。

//HTML
<link href="http://127.0.0.1/css/style.css" type="text/css" rel="stylesheet" charset="utf-8">

//LESS文件(不需要手动保证.css文件的存在和更新,server会自动帮你编译)
├── dist
└── src
  ├── css
  │   └── style.less
  └── js

Config

http://127.0.0.1:3000/.config

LiveReload

项目配置文件nodewebx-config.js中新增liveReload段配置:

module.exports = {
  "liveReload": function (vfs, reload) {
    vfs.watch('source/**/*.js', function (event) {
      vfs.src(event.path)
        .pipe(reload());
    });
    vfs.watch('source/**/*.less', function (event) {
      vfs.src('source/css/modules/*.less')
        .pipe(reload({base:__dirname,extname:'.css'}));
    });
  },
  "webx": ...
}

浏览器中安装LiveReload扩展