Skip to content

Instantly share code, notes, and snippets.

@hideki-a
Created November 26, 2015 09:09
Show Gist options
  • Select an option

  • Save hideki-a/876a83edcdc710555ad2 to your computer and use it in GitHub Desktop.

Select an option

Save hideki-a/876a83edcdc710555ad2 to your computer and use it in GitHub Desktop.
インデントなしHTMLをインデントありHTMLに変換
{
"indent": 2,
"indent_char": " ",
"indent_scripts": "normal",
"wrap_line_length": 0,
"brace_style": "expand",
"preserve_newlines": true,
"max_preserve_newlines": 1,
"unformatted": [
"a",
"code",
"pre"
]
}
'use strict'
module.exports = (grunt) ->
require('jit-grunt') grunt
grunt.loadNpmTasks 'grunt-notify'
grunt.initConfig
prettify:
options:
config: '.prettifyrc'
all:
expand: true,
cwd: '../htdocs',
ext: '.html',
src: ['**/*.html'],
dest: '../dist'
replace:
htmlindent:
src: [
'../dist/*.html'
'../dist/**/*.html'
]
overwrite: true,
replacements: [
{
from: /<\/div>\n\s+<!--\s\/(#|\.)/g
to: '</div><!-- /$1'
},
]
# Register tasks.
grunt.registerTask 'htmlindent', [
'prettify:all'
'replace:htmlindent'
]
return;
{
"name": "generator-skyward",
"version": "1.0.0",
"scripts": {
"start": "grunt",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-notify": "^0.4.1",
"grunt-prettify": "^0.4.0",
"grunt-text-replace": "^0.3.12",
"jit-grunt": "^0.9.0"
},
"private": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment