Skip to content

Commit

Permalink
bla
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Feb 15, 2017
1 parent 0281187 commit f4a2461
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**/*.d.ts

!scripts/index.js
!scripts/plugins
!scripts/plugins/**/*

.DS_Store/

Expand Down
36 changes: 36 additions & 0 deletions scripts/plugins/rollup-plugin-livereload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';

var livereload = require('livereload');
var path = require('path');

var opts = { consoleLogMsg: true };

function livereload$1 (options) {
if ( options === void 0 ) options = { watch: '' };

if (typeof options === 'string') {
options = Object.assign(opts, { watch: options });
}

var port = options.port || 35729;
var server = livereload.createServer(options);
server.watch(path.resolve(process.cwd(), options.watch));

opts = Object.assign(opts, options);

return {
name: 'livereload',
banner: ("document.write('<script src=\"http" + (options.https?'s':'') + "://' + (location.host || 'localhost').split(':')[0] + ':" + port + "/livereload.js?snipver=1\"></' + 'script>');"),
ongenerate: function ongenerate () {
if (opts.consoleLogMsg) {
console.log(green('LiveReload enabled'));
}
}
}
}

function green (text) {
return '\u001b[1m\u001b[32m' + text + '\u001b[39m\u001b[22m'
}

module.exports = livereload$1;

0 comments on commit f4a2461

Please sign in to comment.