標籤:

編譯同樣的scss,為什麼gulp的速度幾乎是grunt的兩倍?

用plugin編譯同樣的scss,為什麼gulp的速度比grunt快很多?


最主要的原因是 Grunt 處理中間文件的時候用的是磁碟的讀寫,而 Gulp 用的是內存。

參考自這裡:http://www.hongkiat.com/blog/gulp-vs-grunt/

Assume you would like to write SASS code for your project. You would want to compile your SASS code and then perhaps minify it.

Grunt handles this using intermediary files which are disk I/O operations. Your SASS file is compiled and then written to a temporary file. The temporary file is used by the autoprefixer and then the final product is written to the destination file.

Gulp takes care of all this in-memory. Your source SASS file is compiled, the result is passed to the autoprefixer without being written to a file and the destination file is then written out.

Compared to in-memory operations, disk writes are slow which means thatGulp has a big speed advantage (for now). A speed comparison was done bytech.tmw which shows that most tasks are at least twice as fast on Gulp.

還有這裡~http://jaysoo.ca/2014/01/27/gruntjs-vs-gulpjs/


我很好奇,對於大多數的前端開發來說,選擇gulp還是grunt應該是哪一個框架更符合自己的開發思維,而不是為了編譯時那幾秒、幾毫秒的速度帶來的快感。

凡事都追求速度,小心女友的抱怨……


gulp的task完全流程化,很簡潔,而grunt,呵呵


十分認同gulp在內存中編譯「中間件」的方式, [f2e-server] 直接採用的更加實時的讀文件編譯,響應輸出,而不是寫文件 f2e-server 專為前端打造的開發伺服器


推薦閱讀:

有沒有好的gulp+webpack的例子啊?求指教,分開來都是會用的,但是結合起來就有些懵。。
在前端打包時,加入了source map之後文件變大如何處理?
gulp或者grunt中有哪些神一般的task?

TAG:grunt | gulp |