You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/tracker/compile.js

18 lines
587 B
JavaScript

const uglify = require("uglify-js");
const fs = require('fs')
const path = require('path')
function relPath(segment) {
return path.join(__dirname, segment)
}
function compilefile(input, output) {
const code = fs.readFileSync(input).toString()
const result = uglify.minify(code)
fs.writeFileSync(output, result.code)
}
compilefile(relPath('src/plausible.js'), relPath('../priv/tracker/js/plausible.js'))
compilefile(relPath('src/p.js'), relPath('../priv/tracker/js/p.js'))
fs.copyFileSync(relPath('../priv/tracker/js/plausible.js'), relPath('../priv/tracker/js/analytics.js'))