FunnelEnvy/optimizely-cli

View on GitHub
templates/install.user.js.ejs

Summary

Maintainability
Test Coverage
// ==UserScript==
// @name         Optimizely-cli Injection Script
// @author       FunnelEnvy
// @homepage     http://www.funnelenvy.com/optimizely-cli
// @source       https://github.com/funnelenvy/optimizely-cli
// @namespace    optcli
// @description  Inject local experiment JS / CSS into a Chrome page for development 
// @include      /optcli=activate/
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js
// ==/UserScript==

var scriptElement = document.createElement('script');
scriptElement.type = 'text/javascript';
scriptElement.src =  '//localhost:<%- _port %>/variation.js';
document.head.appendChild(scriptElement);

var stylesheet = document.createElement('link');
stylesheet.rel = 'stylesheet';
stylesheet.href = '//localhost:<%- _port %>/variation.css';
document.head.appendChild(stylesheet);