From d66eae86eba8d2fb0e9a2e6acf40d67100d128d8 Mon Sep 17 00:00:00 2001 From: Dan Janosik Date: Wed, 1 Aug 2018 10:40:27 -0400 Subject: [PATCH] pre-compile less to css for performance --- .gitignore | 2 ++ README.md | 12 +++++++----- package.json | 21 +++++++++++++++++++-- views/layout.pug | 3 +-- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 00cbbdf..31f1139 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,5 @@ typings/ # dotenv environment variables file .env + +public/css/radial-progress.css diff --git a/README.md b/README.md index 3c55fcf..e32068c 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,13 @@ The below instructions are geared toward BTC, but can be adapted easily to other ## Instructions 1. Clone this repo -2. `npm install` to install all required dependencies -3. Edit the "rpc" settings in [credentials.js](app/credentials.js) to target your node -4. Optional: Change the "coin" value in [config.js](app/config.js). Currently supported values are "BTC" and "LTC". -5. `npm start` to start the local server -6. Visit http://127.0.0.1:3002/ +2. `npm install` +3. `npm run build` +4. Edit the "rpc" settings in [credentials.js](app/credentials.js) to target your node +5. Optional: Change the "coin" value in [config.js](app/config.js). Currently supported values are "BTC" and "LTC". +6. Optional: Add an ipstack.com API access key to [credentials.js](app/credentials.js). Doing so will add a map to the /peers page. +7. `npm start` to start the local server +8. Visit http://127.0.0.1:3002/ ## Run via Docker diff --git a/package.json b/package.json index 5c8adf0..f5c2756 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,23 @@ { "name": "btc-rpc-explorer", "version": "1.0.0", + "description": "Explorer for Bitcoin and RPC-compatible blockchains", "private": false, "scripts": { - "start": "node ./bin/www" + "start": "node ./bin/www", + "build": "npm-run-all build:*", + "build:less": "lessc ./public/css/radial-progress.less ./public/css/radial-progress.css" + }, + "keywords": [ + "bitcoin", + "litecoin", + "blockchain" + ], + "author": "Dan Janosik ", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/janoside/btc-rpc-explorer.git" }, "dependencies": { "bitcoin-core": "2.0.0", @@ -16,7 +30,6 @@ "express": "~4.16.3", "express-session": "1.15.6", "jstransformer-markdown-it": "^2.0.0", - "less": "3.8.0", "lru-cache": "4.1.3", "moment": "^2.21.0", "moment-duration-format": "2.2.2", @@ -26,5 +39,9 @@ "request": "2.85.0", "serve-favicon": "^2.5.0", "simple-git": "1.92.0" + }, + "devDependencies": { + "less": "3.8.0", + "npm-run-all": "^4.1.3" } } diff --git a/views/layout.pug b/views/layout.pug index f7cd216..ddced07 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -15,7 +15,7 @@ html(lang="en") link(rel="stylesheet", href="https://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css") link(rel="stylesheet", href="https://fonts.googleapis.com/css?family=Source+Code+Pro|Ubuntu") link(rel="stylesheet", href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css") - link(rel="stylesheet/less", href="/css/radial-progress.less", type="text/css") + link(rel="stylesheet", href="/css/radial-progress.css", type="text/css") link(rel='stylesheet', href='/css/styling.css') link(rel="icon", type="image/png", href=("/img/logo/" + config.coin.toLowerCase() + ".png")) @@ -164,7 +164,6 @@ html(lang="en") script(defer, src="https://use.fontawesome.com/releases/v5.0.10/js/all.js", integrity="sha384-slN8GvtUJGnv6ca26v8EzVaR9DC58QEwsIk9q1QXdCU8Yu8ck/tL/5szYlBbqmS+", crossorigin="anonymous") script(src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js") - script(src="//cdnjs.cloudflare.com/ajax/libs/less.js/3.8.0/less.min.js") script. $(document).ready(function() {