├── .editorconfig
├── .gitignore
├── .npmignore
├── .prettierrc.json
├── .travis.yml
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── declarations.d.ts
├── index.ts
├── jasmine.json
├── package-lock.json
├── package.json
├── test
└── plugin.spec.ts
└── tsconfig.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 |
3 | root = true
4 |
5 | [*]
6 | indent_style = space
7 | indent_size = 2
8 | end_of_line = lf
9 | charset = utf-8
10 | trim_trailing_whitespace = true
11 | insert_final_newline = true
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /coverage
3 | /.nyc_output
4 | **/*.js
5 | **/*.map
6 | **/*.d.ts
7 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | **/*
2 | !**/*.js
3 | !**/*.map
4 | !**/*.d.ts
5 | !**/*.md
6 |
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true
3 | }
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "node"
4 | script:
5 | - npm test
6 | - npm run coveralls
7 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 | ### [1.2.6](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.2.5...v1.2.6) (2021-03-09)
6 |
7 |
8 | ### Bug Fixes
9 |
10 | * add support for rollup 2.0.0 ([f305718](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/f30571856c744efc3a90cc2f5b0c97a122ea3043)), closes [#15](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/issues/15)
11 | * upate minify-html-literals to v1.3.5 ([ab89bb0](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/ab89bb00b2391b7c342f05cca73d640f68e7c7c5))
12 |
13 | ### [1.2.5](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.2.4...v1.2.5) (2020-08-18)
14 |
15 |
16 | ### Bug Fixes
17 |
18 | * update minify-html-literals to v1.3.2 ([3408e5c](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/3408e5c8edd76452dc58745444e33e70ef1a93e3))
19 |
20 | ### [1.2.4](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.2.3...v1.2.4) (2020-06-10)
21 |
22 |
23 | ### Bug Fixes
24 |
25 | * update minify-html-literals to v1.3.1 ([a1eb2ef](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/a1eb2ef26587c2abc521ffe66d16a6c22451043b))
26 |
27 | ### [1.2.3](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.2.2...v1.2.3) (2020-02-08)
28 |
29 | ### Bug Fixes
30 |
31 | - update to minify-html-literals v1.3.0 ([56cfb8d](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/56cfb8d3dfc5d828a824cbeb92c3aab53bda379a))
32 |
33 |
34 |
35 | ## [1.2.2](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.2.1...v1.2.2) (2019-02-13)
36 |
37 | ### Bug Fixes
38 |
39 | - failure to minify templates prefixed with comments ([ea8c98e](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/ea8c98e))
40 |
41 |
42 |
43 | ## [1.2.1](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.2.0...v1.2.1) (2019-02-13)
44 |
45 | ### Bug Fixes
46 |
47 | - remove source files from package ([b784735](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/b784735))
48 |
49 |
50 |
51 | # [1.2.0](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.1.2...v1.2.0) (2019-02-13)
52 |
53 | ### Bug Fixes
54 |
55 | - accept rollup 1 as peerDep ([#2](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/issues/2)) ([2867985](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/2867985))
56 |
57 | ### Features
58 |
59 | - minify CSS tagged template literals ([6baf3c2](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/6baf3c2))
60 |
61 |
62 |
63 | ## [1.1.2](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.1.1...v1.1.2) (2018-11-29)
64 |
65 | ### Bug Fixes
66 |
67 | - update minify-html-literals to 1.1.2 ([2a26e9c](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/2a26e9c))
68 |
69 |
70 |
71 | ## [1.1.1](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.1.0...v1.1.1) (2018-10-25)
72 |
73 | ### Bug Fixes
74 |
75 | - update minify-html-literals to 1.1.1 ([6abe9bb](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/6abe9bb))
76 |
77 |
78 |
79 | # [1.1.0](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.0.7...v1.1.0) (2018-10-24)
80 |
81 | ### Features
82 |
83 | - update minify-html-literals to 1.1.0 ([a1d9f1d](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/a1d9f1d))
84 |
85 |
86 |
87 | ## [1.0.7](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.0.6...v1.0.7) (2018-10-05)
88 |
89 | ### Bug Fixes
90 |
91 | - do not remove tag whitespace ([7d4d289](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/7d4d289))
92 |
93 |
94 |
95 | ## [1.0.6](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.0.5...v1.0.6) (2018-10-03)
96 |
97 | ### Bug Fixes
98 |
99 | - do not collapse boolean attributes for Polymer binding syntax ([8597d14](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/8597d14))
100 |
101 |
102 |
103 | ## [1.0.5](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.0.4...v1.0.5) (2018-09-27)
104 |
105 | ### Bug Fixes
106 |
107 | - update parse-literals to minify escaped characters properly ([ff2df26](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/ff2df26))
108 |
109 |
110 |
111 | ## [1.0.4](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.0.3...v1.0.4) (2018-09-19)
112 |
113 | ### Bug Fixes
114 |
115 | - update minify-html-literals to not sort attributes or classes ([dc66de0](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/dc66de0))
116 |
117 |
118 |
119 | ## [1.0.3](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.0.2...v1.0.3) (2018-09-19)
120 |
121 | ### Bug Fixes
122 |
123 | - update minify-html-literals to use hires sourcemaps ([8dcb055](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/8dcb055))
124 |
125 |
126 |
127 | ## [1.0.2](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.0.1...v1.0.2) (2018-09-13)
128 |
129 | ### Bug Fixes
130 |
131 | - do not require fileName in minify options ([9543ef1](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/9543ef1))
132 | - update dependencies and typings ([0a43630](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/0a43630))
133 |
134 |
135 |
136 | ## [1.0.1](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/compare/v1.0.0...v1.0.1) (2018-07-24)
137 |
138 | ### Bug Fixes
139 |
140 | - typescript build issues ([0d1b01f](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/0d1b01f))
141 |
142 |
143 |
144 | # 1.0.0 (2018-07-23)
145 |
146 | ### Features
147 |
148 | - initial release ([e3f2d8c](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/commit/e3f2d8c))
149 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright 2018 Elizabeth Mitchell
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # rollup-plugin-minify-html-literals
2 |
3 | [](https://www.npmjs.com/package/rollup-plugin-minify-html-literals)
4 | [](https://travis-ci.com/asyncLiz/rollup-plugin-minify-html-literals)
5 | [](https://coveralls.io/github/asyncLiz/rollup-plugin-minify-html-literals?branch=master)
6 |
7 | Uses [minify-html-literals](https://www.npmjs.com/package/minify-html-literals) to minify HTML and CSS markup inside JavaScript template literal strings.
8 |
9 | ## Usage
10 |
11 | ```js
12 | import babel from 'rollup-plugin-babel';
13 | import minifyHTML from 'rollup-plugin-minify-html-literals';
14 | import { uglify } from 'rollup-plugin-uglify';
15 |
16 | export default {
17 | entry: 'index.js',
18 | dest: 'dist/index.js',
19 | plugins: [
20 | minifyHTML(),
21 | // Order plugin before transpilers and other minifiers
22 | babel(),
23 | uglify()
24 | ]
25 | };
26 | ```
27 |
28 | By default, this will minify any tagged template literal string whose tag contains "html" or "css" (case insensitive). [Additional options](https://www.npmjs.com/package/minify-html-literals#options) may be specified to control what templates should be minified.
29 |
30 | ## Options
31 |
32 | ```js
33 | export default {
34 | entry: 'index.js',
35 | dest: 'dist/index.js',
36 | plugins: [
37 | minifyHTML({
38 | // minimatch of files to minify
39 | include: [],
40 | // minimatch of files not to minify
41 | exclude: [],
42 | // set to `true` to abort bundling on a minification error
43 | failOnError: false,
44 | // minify-html-literals options
45 | // https://www.npmjs.com/package/minify-html-literals#options
46 | options: null,
47 |
48 | // Advanced Options
49 | // Override minify-html-literals function
50 | minifyHTMLLiterals: null,
51 | // Override rollup-pluginutils filter from include/exclude
52 | filter: null
53 | })
54 | ]
55 | };
56 | ```
57 |
58 | ## Examples
59 |
60 | ### Minify Polymer Templates
61 |
62 | ```js
63 | import minifyHTML from 'rollup-plugin-minify-html-literals';
64 | import { defaultShouldMinify } from 'minify-html-literals';
65 |
66 | export default {
67 | entry: 'index.js',
68 | dest: 'dist/index.js',
69 | plugins: [
70 | minifyHTML({
71 | options: {
72 | shouldMinify(template) {
73 | return (
74 | defaultShouldMinify(template) ||
75 | template.parts.some(part => {
76 | // Matches Polymer templates that are not tagged
77 | return (
78 | part.text.includes('