Skip to content

Commit ed93c94

Browse files
author
Asad Memon
committed
dont compress svg by default
1 parent 9747134 commit ed93c94

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

docs/html/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
Zero doesn't just serve HTML as is. URLs to scripts, styles, media, and other HTML files are extracted and compiled. The references are rewritten in the HTML so that they link to the correct output files. All filenames should be relative to the current HTML file.
44

55
Zero's HTML bundler is powered by [Parcel](https://parceljs.org/).
6+
7+
**Note:** When linking to other HTML pages, do not put `.html` at the end ie. Use `<a href="/about">` instead of `<a href="/about.html">`.

packages/core/lib/builder/installPackages.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const babelConfig = {
2424
]
2525
};
2626

27+
const htmlnanoConfig = {
28+
minifySvg: false
29+
};
30+
2731
function runYarn(cwd, args, resolveOutput) {
2832
const isWin = os.platform() === "win32";
2933
var yarnPath = require.resolve("yarn/bin/yarn.js");
@@ -224,6 +228,17 @@ async function writePackageJSON(buildPath, deps) {
224228
"utf8"
225229
);
226230

231+
var htmlnanoPath = path.join(buildPath, "/.htmlnanorc");
232+
var htmlnanoSrcPath = path.join(process.env.SOURCEPATH, "/.htmlnanorc");
233+
// only write htmlnano file if not overriden by user
234+
if (!fs.existsSync(htmlnanoSrcPath)) {
235+
fs.writeFileSync(
236+
htmlnanoPath,
237+
JSON.stringify(htmlnanoConfig, null, 2),
238+
"utf8"
239+
);
240+
}
241+
227242
// also save any newfound deps into user's pkg.json
228243
// in sourcepath. But minus our hardcoded depsJson
229244

test/www/html/relativeLink.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1>Hyperlink</h1>
2+
<a href="/html/withscriptandstyle">with Script and Style</a>

0 commit comments

Comments
 (0)