Minify HTML
This commit is contained in:
parent
8bf421adba
commit
508e407faf
|
@ -81,6 +81,12 @@ gulp.task('clean', function () {
|
|||
del.sync('./output_*/assets/fonts/*');
|
||||
});
|
||||
|
||||
gulp.task('minify-prod-html', function() {
|
||||
gulp.src('output_prod/**/*.html')
|
||||
.pipe(plugins.htmlmin({ collapseWhitespace: true }))
|
||||
.pipe(gulp.dest('output_prod'));
|
||||
});
|
||||
|
||||
gulp.task('build', ['clean', 'styles', 'scripts', 'fonts']);
|
||||
|
||||
gulp.task('default', ['build', 'watch']);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"del": "^2.2.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-htmlmin": "^1.3.0",
|
||||
"gulp-if": "^2.0.0",
|
||||
"gulp-imagemin": "^2.4.0",
|
||||
"gulp-livereload": "^3.8.1",
|
||||
|
|
|
@ -11,5 +11,8 @@ gulp build --production
|
|||
./vendor/bin/sculpin generate --env=${ENV} --clean --no-interaction
|
||||
if [ $? -ne 0 ]; then echo "Could not generate the site"; exit 1; fi
|
||||
|
||||
# Minify HTML.
|
||||
gulp minify-prod-html
|
||||
|
||||
rsync -av --delete output_${ENV}/ ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}
|
||||
if [ $? -ne 0 ]; then echo "Could not publish the site"; exit 1; fi
|
||||
|
|
|
@ -99,15 +99,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if site.google_analytics_tracking_id %}
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '{{ site.google_analytics_tracking_id }}', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '{{ site.google_analytics_tracking_id }}', 'auto'); ga('send', 'pageview');</script>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -19,7 +19,7 @@ use:
|
|||
{% if post.blocks.excerpt %}
|
||||
{{ post.blocks.excerpt|raw }}
|
||||
{% else %}
|
||||
<p>{{ post.blocks.content|raw|split(' ')|slice(0,50)|join(' ')|replace({ 'h2':'h3' })|raw }} …</p>
|
||||
<p>{{ post.blocks.content|raw|striptags|split(' ')|slice(0,50)|join(' ')|replace({ 'h2':'h3' }) }} …</p>
|
||||
{% endif %}
|
||||
|
||||
<a href="{{ post.url }}">Read more →</a>
|
||||
|
|
Reference in a new issue