forked from basecamp/trix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
15 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
const path = require("path") | ||
const fs = require("fs") | ||
const sass = require("node-sass") | ||
const { optimize } = require("svgo") | ||
import path from "path" | ||
import fs from "fs" | ||
import sass from "sass" | ||
import { optimize } from "svgo" | ||
|
||
const types = sass.types | ||
const basePath = "./assets/" | ||
|
||
module.exports = { | ||
export default { | ||
"svg($svgFileName)": function (svgFileName) { | ||
const filename = path.resolve(basePath, svgFileName.getValue()) | ||
const filename = path.resolve(basePath, svgFileName.getValue()) | ||
|
||
let svgContent = fs.readFileSync(filename, "utf8") | ||
svgContent = optimize(svgContent, { multipass: true, datauri: "enc" }) | ||
let svgContent = fs.readFileSync(filename, "utf8") | ||
svgContent = optimize(svgContent, { multipass: true, datauri: "enc" }) | ||
|
||
return new types.String(`url("${svgContent.data}")`) | ||
return new types.String(`url("${svgContent.data}")`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters