4 module.exports = LessPlugin = (function() {
5 LessPlugin.identifier = 'less';
7 LessPlugin.version = '1.0';
9 function LessPlugin(window, host) {
14 LessPlugin.prototype.reload = function(path, options) {
15 if (this.window.less && this.window.less.refresh) {
16 if (path.match(/\.less$/i)) {
17 return this.reloadLess(path);
19 if (options.originalPath.match(/\.less$/i)) {
20 return this.reloadLess(options.originalPath);
26 LessPlugin.prototype.reloadLess = function(path) {
27 var link, links, _i, _len;
29 var _i, _len, _ref, _results;
30 _ref = document.getElementsByTagName('link');
32 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
34 if (link.href && link.rel.match(/^stylesheet\/less$/i) || (link.rel.match(/stylesheet/i) && link.type.match(/^text\/(x-)?less$/i))) {
40 if (links.length === 0) {
43 for (_i = 0, _len = links.length; _i < _len; _i++) {
45 link.href = this.host.generateCacheBustUrl(link.href);
47 this.host.console.log("LiveReload is asking LESS to recompile all stylesheets");
48 this.window.less.refresh(true);
52 LessPlugin.prototype.analyze = function() {
54 disable: !!(this.window.less && this.window.less.refresh)