Skip to content

Commit 3e8981e

Browse files
adriaandotcomAdriaan
authored andcommitted
Add currentScript, build script, and add dev to deploy script
1 parent 3b270ce commit 3e8981e

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

deploy.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
4646
echo "==> Deploying non SRI v$VERSION files to $SERVER_NAME"
4747
rsync --rsync-path="sudo rsync" "$SCRIPTS_LATEST_PATH/e.js" "$REMOTE_PATH/events.js"
4848
rsync --rsync-path="sudo rsync" "$SCRIPTS_LATEST_PATH/e.js.map" "$REMOTE_PATH/events.js.map"
49+
rsync --rsync-path="sudo rsync" "$SCRIPTS_LATEST_PATH/latest.dev.js" "$REMOTE_PATH/latest.dev.js"
4950
rsync --rsync-path="sudo rsync" "$SCRIPTS_LATEST_PATH/latest.js" "$REMOTE_PATH/latest.js"
5051
rsync --rsync-path="sudo rsync" "$SCRIPTS_LATEST_PATH/latest.js.map" "$REMOTE_PATH/latest.js.map"
5152
rsync --rsync-path="sudo rsync" "$SCRIPTS_LATEST_PATH/light.js" "$REMOTE_PATH/light.js"
@@ -65,4 +66,4 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
6566
echo -e "==> ${GREEN}Woop woop! Deployed to $SERVER_NAME!${RESET}"
6667
else
6768
echo '==> Cancelled by you'
68-
fi
69+
fi

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"scripts": {
77
"minify": "node minify.js",
88
"watch": "node_modules/.bin/nodemon minify.js --ignore dist",
9+
"build": "node minify.js",
910
"pretest": "npm run minify -- testing",
1011
"test": "if [ ! $BROWSERSTACK_USERNAME ]; then node -r dotenv/config ./test/index.js; else node ./test/index.js; fi",
1112
"posttest": "npm run minify"

src/default.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@
285285
//
286286

287287
// Find the script element where options can be set on
288-
var scriptElement = doc.querySelector('script[src*="' + baseUrl + '"]');
288+
var scriptElement =
289+
doc.currentScript || doc.querySelector('script[src*="' + baseUrl + '"]');
289290
var attr = function (scriptElement, attribute) {
290291
return scriptElement && scriptElement.getAttribute("data-" + attribute);
291292
};

0 commit comments

Comments
 (0)