l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

README.md (833B)


      1 # Import
      2 
      3 Temporary solution to inline importing front-end Javascript for modular development.
      4 
      5 Has tabulation support.
      6 More lightweight than [smash](https://github.com/mbostock/smash).
      7 Removed automatically importing 'index.js'.
      8 
      9 ## Installation
     10 ```npm install import -g```
     11 
     12 ## How to Use
     13 foo.js
     14 ```
     15 function foo(){
     16 	return "foo";
     17 }
     18 ```
     19 
     20 bar.js
     21 ```
     22 function bar(){
     23 	console.log("bar");
     24 }
     25 ```
     26 
     27 baz.js
     28 ```
     29 import "foo";
     30 
     31 function baz(){
     32 	console.log(foo());
     33 	return import "bar";
     34 }
     35 baz()();
     36 ```
     37 
     38 ***
     39 
     40 See final output
     41 ```
     42 $ import test/data1/baz.js
     43 function foo(){
     44 	return "foo";
     45 }
     46 
     47 function baz(){
     48 	console.log(foo());
     49 	return function bar(){
     50 		console.log("bar");
     51 	}
     52 }
     53 baz()();
     54 ```
     55 
     56 or Create an output file
     57 ```
     58 $ import test/data1/baz.js > test/data1/out.js
     59 ```
     60 
     61 or Execute in Node
     62 ```
     63 $ import test/data1/baz.js | node
     64 foo
     65 bar
     66 ```