Mr.Node

A Javascript Library for Node.js Functions

About

Mr.Node is very fast and also very easy to use. Simple, self-explanatory functions get the code to work like it should. He is very smart... ヾ(⌐■_■)ノ

Documentation

Npm:

$ npm install --save-dev mrnode

Bower:

$ bower install --save-dev mrnode

CDN:

<script src="https:[email protected]"></script>

Usage

These functions practically explain themselves.

          
            //Functions

            //Creating files

            create('filename', 'fileextension');

            //Minify JS and CSS
            //use the gulp-uglify in the terminal
            minifyjs();
            minifycss();
            
        
Getting Started

Use node's require attribute. Do this in a file called mrnode.js. Create this file in the root of your directory.

          
            var mrnode = require('mrnode');
          
        

After you have done that, you are all set! Right after you have typed in one of Mr.Node's functions, type this into your terminal: $ node mrnode.js. Note: To do this you must be in the directory of your project. If you don't know how to do that, here you go: $ cd \Users\youruser\yourdirectory.

Creating Files

This takes the dependent of "fs"(filesystem). This is a node module. The dependencies are already listed in the package.JSON.

          
            //Functions

            mrnode.create('filename', 'fileextension');
          
        

For creating files you are now able to choose a file extension. You type in the file name as the first parameter and the file extension as the second parameter.

Minifying Files

Use these functions to minify certain files

          
            //Minify JS and CSS
            //use the gulp-uglify in the terminal
            mrnode.minifyjs('yourfolder/yourfile','yourdestination');
            mrnode.minifycss('yourfolder/yourfile','yourdestinationfolder');
          
        

For minifyjs();, use in the terminal: $ gulp uglify. For minifycss();, use in the terminal: $ gulp minify.

Deleting Javascript Files

You use this to delete a javascript file.

          
            //Functions

            mrnode.delete('yourfolder/yourfile', 'yourdestination');
          
        

Before this, you type in your file that you want to delete as the first parameter. Then you type in your destination folder so that the program knows where the code should end up.

Beautify

This shows you how to beautify files.

          
            //Functions

            mrnode.beautify('yourfolder/yourfile', 'yourdestinationfolder');
          
        

For this function, you choose which file to beautify by typing your file directory into the parameters for the function. Then type in your destination folder so that the program knows where the files should end up.

Convert Sass to CSS

This shows you how to convert Sass to CSS with Mr.Node.

          
            //Functions

            mrnode.csass('yourfolder/yourfile', 'yourdestinationfolder');
          
        

For this you want to type in your own file into the function parameter area, then go to your terminal and type this: $ gulp sass. This new css file will be in your destination folder.

Renaming Files

This will show you how to rename your files.

          
            //Functions

            mrnode.renameit('yourfolder/yourfile,'newname','yourdestinationfolder');
          
        

First you want to type in the first parameter of what file you want to rename. Then type in the new name in the second parameter. Then all you need to do is type in the destination folder you want your renamed file to go to, in the third parameter.

Creating a Server

Creating a Node.js server can be pretty difficult for some people. So Mr.Node gives you a very simple function to create a server.

          
            mrnode.createserver('port');
          
        

The only thing that Mr.Node requires you to do in this function is type in the port that you would like your server to be hosted on. The port mush be 4 numbers, such as: 3000. Type in to your terminal: $ node mrnode.js. Now go to http://localhost:yourport. Your server should be running!

Transpiling files

This will take you through how to transpile es6 to es5.

            
                mrnode.transpile('yourfile', 'destination');
            
        

All that you have to do is type in the file that you want to transpile. Then just select a destination of where you want the file to go when it is done transpiling.