0.0.6 ⢠Published 5 years ago
node-rm v0.0.6
š NodeRM
āļø remove all extra spaces and comments from files and bundle it into one file
npm i node-rm --save-dev
Usage
const { bundle, rmSpacesComments, readFiles, getFiles, writeOrCreateFile } = require('node-rm')
Methods & Examples
- bundle(directory: String, outFileName: String): Promise
bundle all files in directory into one file
bundle('./myDirectory', 'bundle.js')
- rmSpacesComments(String):String
remove spaces and comments from a string
rmSpacesComments(`
// comment
let a = () => { console.log('hello world')}
`)
// let a = () => { console.log('hello world')}
- getFiles(directory: String): Array
return files path from directory
getFiles('./tests')
// [ './tests/sub/another-file.js', './tests/first-file.js']
- readFiles(files: Array): String
read files and return the content of files
let files = getFiles('./tests') // [ './tests/sub/another-file.js', './tests/first-file.js']
readFiles(files);
- writeOrCreateFile(data: String, outFileName: String): Promise
if file exists will write / else will create a new file and write
writeOrCreateFile('hello world', 'out-file.js')
License
MIT