Skip to content

Commit

Permalink
Build files
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJaredWilcurt committed Oct 28, 2019
1 parent ef76d42 commit b5f1eb8
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 0 deletions.
31 changes: 31 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const fs = require('fs');
const sass = require('sass');
const uglify = require('terser');

const sassOptions = {
file: process.cwd() + '/src/index.sass',
indentedSyntax: true,
outputStyle: 'compressed'
};
const sassResult = sass.renderSync(sassOptions);
const css = String(sassResult.css);

let findAndReplaceDOMText;
let findInNw;

try {
findAndReplaceDOMText = String(fs.readFileSync('./node_modules/findandreplacedomtext/src/findAndReplaceDOMText.js'));
findInNw = String(fs.readFileSync('./src/index.js'));
} catch (error) {
console.log(error);
}

findInNw = findInNw.replace('/* PLACEHOLDER */', css);

const result = uglify.minify(findAndReplaceDOMText + findInNw);

try {
fs.writeFileSync('./dist/find-in-nw.js', result.code + '\n');
} catch (error) {
console.log(error);
}
10 changes: 10 additions & 0 deletions dist/find-in-nw.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b5f1eb8

Please sign in to comment.