const replace = require('gulp-replace');
// html
const html = () => {
return src(config.html.src)
.pipe(fileinclude())
.pipe(removeHtmlComments())
.pipe(dest(config.html.dist))
.pipe(server.stream());
}
// path
const config = {
// html
html: {
src: 'src/views/*.html',
dist: 'dist/'
},
........
function getDateTime() {
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth()+1;
var day = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
if(month.toString().length == 1) { var month = '0'+month; }
if(day.toString().length == 1) { var day = '0'+day; }
if(hour.toString().length == 1) { var hour = '0'+hour; }
if(minute.toString().length == 1) { var minute = '0'+minute; }
if(second.toString().length == 1) { var second = '0'+second; }
var dateTime = year+'-'+month+'-'+day+'T'+hour+':'+minute+':'+second;
return dateTime;
}
// styles
const styles = () => {
return src(config.styles.src)
.pipe(
sass({
outputStyle: "expanded"
})
)
.pipe(
group_media()
)
.pipe(postcss([
require('autoprefixer'),
require('postcss-discard-comments'),
require('postcss-csso')
]))
.pipe(
rename({
extname: ".min.css"
})
)
//.pipe(concat(".min.css" + getDateTime())) //date
.pipe(dest(config.styles.dist))
.pipe(server.stream());
}