2012-04-03 8 views

答えて

1

それはNode.jsの持つ可能です:

var fs = require('fs'); 
// read html file 
var fileContents = fs.readFileSync('index.html', 'utf8'); 
// replace rel attribute for less file with rel for css 
fileContents = fileContents.replace(/stylesheet\/less/gi, 'stylesheet'); 
// replace file name 
fileContents = fileContents.replace(/css\/application.less/gi, 'css/application.css'); 
// remove less runtime compiler (if needed) 
fileContents = fileContents.replace(/<script.*?\bless\b[^"']*?\.js.*?<\/script>/g, ''); 
// write file back 
fs.writeFileSync('index.html', fileContents, 'utf8'); 

ちょうどr.js.を呼び出すとともに、ビルドスクリプトの一部としてそれを追加

関連する問題