cmd批處理,webStrom/phpStrom/.....IDE工具編譯

來源:互聯網
上載者:User

標籤:and   nod   func   sed   lap   add   off   isp   編譯   

工具:  有自動編譯的IED工具建立一下檔案,檔案名稱隨意,可修改test.cmd
@echo offCHCP 65001type %~dp0test_cmd.js>test_cmd.jsnode testindex1.jsdel /F /S /Q test_cmd.jsdel /F /S /Q test_cmd.min.js
View Code

 

test_cmd.js前提安裝過node
var fs = require("fs");var fileType = "html";//編譯的檔案類型(檔案尾碼)編譯前var fileTypeTo = "html";//編譯的檔案類型(檔案尾碼)編譯後//檔案寫入function xieru(fileName) {    if(!fileName){        return false;    }    // 建立可讀流    var readerStream = fs.createReadStream(fileName+‘.‘+fileType);    var writerStream = fs.createWriteStream(fileName+‘.min.‘+fileTypeTo);// 設定編碼為 utf8。    readerStream.setEncoding(‘UTF8‘);// 處理流事件 --> data, end, and error    readerStream.on(‘data‘, function(chunk) {        var data = chunk;        data = data.replace(/^aa/img,"張雲山");        writerStream.write(data,‘UTF8‘);        writerStream.end();        // 處理流事件 --> data, end, and error        writerStream.on(‘finish‘, function() {            console.log("寫入完成。");        });        writerStream.on(‘error‘, function(err){            console.log(err.stack);        });    });    readerStream.on(‘end‘,function(){        console.log("讀取完成");    });    readerStream.on(‘error‘, function(err){        console.log(err.stack);    });    console.log("程式執行完畢");}///擷取目前的目錄的檔案fs.readdir("./",function(err, files){    if (err) {        return console.error(err);    }    files.forEach( function (file){        if(file.indexOf("."+fileType) != -1 && file.indexOf("min."+fileType) == -1){            var fileName =  file.replace(new RegExp("\."+fileType+"$","img"),"");            xieru(fileName);        }    });});
View Code

用處:

  可自訂編譯自己的語言,或架構

cmd批處理,webStrom/phpStrom/.....IDE工具編譯

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.