使用Gulp替换blockplaceholder

问题描述 投票:0回答:1

js.pipe scripts and styles will be created by concatenation and minification of original *.css -叮 dev.html

<!-- replaceStart: nameOfBlock-css -->
  <link href="/css/one.css" />
  <link href="/css/two.css" />
  <link href="/css/three.css" />
<!-- replaceEnd-->

<!-- replaceStart: nameOfBlock-js -->
  <link href="/js/one.js"/>
  <link href="/js/two.js/>
<!-- replaceEnd-->

public.html 囫囵吞枣

<link href="/css/oneTwoThree.min.css" />

内容 minifiedCSSLinks.css

<link href="/js/oneTwo.min.js" />

minifiedJSLink.jsgulp-html-replace, 囫囵吞枣gulp-string-replace但我不知道如何让它们简单地抓取文件的内容(除了读取文件的内容并以字符串的形式传递给替换函数--我想相信模块可以做到这一点)。理想情况下,我希望在

gulp.src('default.html')
.replace({nameOfBlock-css: 'minifiedCSSLinks.html'})
.replace({nameOfBlock-js: 'minifiedJSLinks.html'})
...

gulpfile.js:EDIT: The *.min.css

replace gulp gulp-replace
1个回答
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.