grunt-combohtml
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "grunt-combohtml", | ||
"description": "The best Grunt plugin ever.", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"homepage": "", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -1,4 +0,4 @@ | ||
# grunt-flexcombo | ||
# grunt-combohtml | ||
> [flex-combo](https://npmjs.org/package/flex-combo)插件的grunt版本. | ||
合并带有SSI的html代码,并提取其中引用的本地css和js,将他们合并为一个js和一个css,并输出构建好的html | ||
@@ -12,3 +12,3 @@ ## Getting Started | ||
```shell | ||
npm install grunt-flexcombo --save-dev | ||
npm install grunt-combohtml --save-dev | ||
``` | ||
@@ -19,3 +19,3 @@ | ||
```js | ||
grunt.loadNpmTasks('grunt-flexcombo'); | ||
grunt.loadNpmTasks('grunt-combohtml'); | ||
``` | ||
@@ -27,57 +27,32 @@ | ||
在`grunt.initConfig()`中添加flexcombo的配置: | ||
在`grunt.initConfig()`中添加combohtml的配置: | ||
```js | ||
grunt.initConfig({ | ||
flexcombo:{ | ||
options: { | ||
target:'src', | ||
urls:'/group/project', | ||
port:'80', | ||
servlet:'?', | ||
separator:',', | ||
charset:'utf8' | ||
}, | ||
main:{} | ||
combohtml:{ | ||
options:{ | ||
encoding:'utf8' | ||
}, | ||
main:{ | ||
files: [ | ||
{ | ||
expand: true, | ||
cwd:'src', | ||
src: ['**/*.html'], | ||
dest: 'build/', | ||
ext: '.html' | ||
} | ||
] | ||
} | ||
} | ||
}); | ||
``` | ||
你的host指向开发机,访问http://host/group/projecct,浏览你的页面和assets文件 | ||
将cdn配向开发机 | ||
127.0.0.1 g.tbcdn.cn | ||
可以访问你的页面和asset文件 | ||
http://g.tbcdn.cn/group/project | ||
更多配置请参照[flex-combo](https://npmjs.org/package/flex-combo)。 | ||
## 说明 | ||
该服务添加了[jayli-server](https://npmjs.org/package/jayli-server),支持标准格式的 SSI include | ||
该服务依赖[jayli-server](https://npmjs.org/package/jayli-server),支持标准格式的 SSI include | ||
<!--#include path="asdf.html" --> | ||
<!--#include path="file.html" --> | ||
## 使用 | ||
建议同[generator-clam](https://npmjs.org/package/generator-clam)一同使用,构建工具生成本地配置文件,形如: | ||
flexcombo:{ | ||
options: { | ||
target:'src', | ||
urls:'/<%= pkg.group %>/<%= pkg.name %>', | ||
port:'<%= port %>', | ||
servlet:'?', | ||
separator:',', | ||
charset:'utf8' | ||
}, | ||
main:{} | ||
} | ||
执行任务 | ||
task.run(['flexcombo']); |
@@ -51,4 +51,4 @@ /* | ||
var js_content = concat(result.js,dest_js,v.orig.cwd); | ||
var css_content = concat(result.css,dest_css,v.orig.cwd); | ||
var js_content = concat(result.js,dest_js,v.orig.cwd,p); | ||
var css_content = concat(result.css,dest_css,v.orig.cwd,p); | ||
@@ -79,3 +79,3 @@ chunk = chunk.replace('@@script',path.basename(v.dest,path.extname(v.dest)) + '.js'); | ||
} | ||
return "\033[" + num +"m" + str + "\033[0m" | ||
return "\033[" + num +"m" + str + "\033[0m"; | ||
} | ||
@@ -82,0 +82,0 @@ |
@@ -11,6 +11,9 @@ // 'use strict'; | ||
// 'output.js' | ||
// 'build/' | ||
function concat(a,o,dest){ | ||
// 'src/' | ||
// 'src/~page/index.html' | ||
function concat(a,o,dest,p){ | ||
var content = ''; | ||
var a = a.reverse(); | ||
var rel = path.dirname(path.relative(dest,p)); | ||
fs.writeFileSync(o,'',{ | ||
@@ -21,4 +24,4 @@ encoding:'utf8' | ||
var str = ''; | ||
var ap = path.resolve(pwd,dest,v); | ||
// console.log(ap); | ||
// var ap = path.resolve(pwd,dest,v); | ||
var ap = path.resolve(pwd,dest,rel,v); | ||
if(!fs.existsSync(ap)){ | ||
@@ -25,0 +28,0 @@ return; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1081
41362
17
56