Code Monkey home page Code Monkey logo

sitejson's Introduction

sitejson

This is Node commandline application used to read data from json file and puts that data into the web page.

How to install

npm install sitejson --save

Folder Structure

.
|--input
	|-- 1.html
	|-- 2.html
|--pagedata.json
|--run-me.js

Placeholder

We need to define the placeholder in the html page. Placeholder should be a single word wrap with ++ as it will be the key in json to represent it's content. For eg.

<!DOCTYPE html>
<html>
	<head>
		<title>++title++</title>
	</head>
<body>
	++content1++  
</body>
</html> 

pagedata.json

'pagedata.json' contains all the data in key value form. As mention earlier key will be the placeholder. For eg.

{
	"title": "My Page",
	"content1": "This is data of content1",
	"content2": "This is data of content2"	
}

We can specify the name of directory which contains html files as a parameter on commandline.

node myprogram.js ./inputFilesDirectory
or
node myprogram.js ./allFiles/subDirectory

How to RUN

Create the program file say run-me.js and add the following code.

var fs = require('fs'),
    sj = require('sitejson');	

    sj.readDirectory();

Now open the command prompt and traverse to the directory where run-me.js is located. Run the following command

node run-me

then we can see the log of files which are process on console and final process files would be available at output folder.

sitejson's People

Contributors

hegdeashwin avatar harshal-sawant avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.