Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-cli-inject-live-reload

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-inject-live-reload - npm Package Compare versions

Comparing version 1.2.3 to 1.3.0

42

index.js

@@ -10,7 +10,18 @@ 'use strict';

if (liveReloadPort && type === 'head') {
return '<script src="//localhost:' + liveReloadPort + '/livereload.js?snipver=1" type="text/javascript"></script>';
return '<script src="/ember-cli-live-reload.js" type="text/javascript"></script>';
}
},
dynamicScript: function(request) {
var liveReloadPort = process.env.EMBER_CLI_INJECT_LIVE_RELOAD_PORT;
return "var src = (location.protocol || 'http:') + '//' + (location.hostname || 'localhost') + ':" + liveReloadPort + "/livereload.js?snipver=1';\n " +
"var script = document.createElement('script');\n " +
"script.type = 'text/javascript';\n " +
"script.src = src;\n " +
"document.getElementsByTagName('head')[0].appendChild(script);"
},
serverMiddleware: function(config) {
var self = this;
var app = config.app;

@@ -21,30 +32,9 @@ var options = config.options;

if (this.shouldUseMiddleware()) {
var livereloadMiddleware = require('connect-livereload');
process.env.EMBER_CLI_INJECT_LIVE_RELOAD_PORT = options.liveReloadPort;
app.use(livereloadMiddleware({
port: options.liveReloadPort
}));
} else {
process.env.EMBER_CLI_INJECT_LIVE_RELOAD_PORT = options.liveReloadPort;
}
},
shouldUseMiddleware: function() {
var version = this.project.emberCLIVersion();
var portions = version.split('.');
portions = portions.map(function(portion) {
return Number(portion.split('-')[0]);
app.use('/ember-cli-live-reload.js', function(request, response, next) {
response.contentType('text/javascript');
response.send(self.dynamicScript());
});
if (portions[0] > 0) {
return false;
} else if (portions[1] > 0) {
return false;
} else if (portions[2] > 46) {
return false;
} else {
return true;
}
}
};
{
"name": "ember-cli-inject-live-reload",
"version": "1.2.3",
"version": "1.3.0",
"description": "Plugin for ember-cli that injects live-reload script into HTML content.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc