sync-snippet
Synchronize code snippet among files.
How to use it?
npm i -D sync-snippet
////sync-code-snippet:ws:start
and ////sync-code-snippet:ws:end
to mark snippet area in files.
1.Use a.js:
////sync-code-snippet:ws:start////sync-code-snippet:ws:end
b.js:
////sync-code-snippet:ws:startvar a=1;////sync-code-snippet:ws:end
c.js:
////sync-code-snippet:ws:start////sync-code-snippet:ws:end
2.Invoke it in nodejs:
const sync = ;
3.Try to edit the code in the snippet area and check the area in other files
Does it support indent?
Yes. It get the indentation by calculating the spaces between the column0 and the start mark and synchronize the snippet area accordingly. Remember to make the snippet area and the start mark have the same indent.
Wrong:
////sync-code-snippet:ws:start var a=1;////sync-code-snippet:ws:end
Right:
////sync-code-snippet:ws:start var a=1; ////sync-code-snippet:ws:end
How to test it?
Clone the repo, run the start.js and try to edit the files in ./test folder.