dalejung / inode

Interactive Node.js
MIT License
3 stars 1 forks source link

allow working on .js file that is included in html file <script> #28

Closed dalejung closed 11 years ago

dalejung commented 11 years ago

This is kind of convoluted but the use case is when you're working on a file like

%run ./bob.html

console.log('bob.js');
<script src="localhost/bob.js"></script>

So basically I'm working on a script file that is part of an html page, but I have the %run directive at the top of js so make it execute the html.

The problem is two fold

  1. bob.js has the run directive which is invalid js and errors when src from the html page
  2. bob.js will run again after the html page is run.
dalejung commented 11 years ago

5467b011b1fd5859a428ad366851baba92c96984

Changed %run to require a comment prefix so

// %run [file] [only_html:false]

If only_html is true, then the js file will not be called