Skip to content

Commit ff2ddb6

Browse files
committed
initial commit
1 parent 335f27e commit ff2ddb6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+5293
-0
lines changed

.directory

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Dolphin]
2+
Timestamp=2019,12,18,17,55,3
3+
Version=4
4+
5+
[Settings]
6+
HiddenFilesShown=true

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# directory
2+
builds/

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Prodyogiki
2+
---
3+
The website is to promote a technocrat event with practical implementation of what has been learnt in NIT Hamirpur, with schedule and registration forms.
4+
5+
To ease the development and maintainence following technologies will be used:
6+
+ **NODE.JS**: To provide modules helpfull in developement. As the site will be static as of now no node features other than npm will be required.
7+
8+
+ **PUG(HTML)**: To easily write and maintain web pages *pug* templating engine provide conveinient way,with python like indentation syntax.
9+
10+
+ **LESS(CSS)**: Extended css with features like inheritance variables improved selectors, completely compatible with traditional css. All of less is compiled down to traditional css files.
11+
12+
13+
DO READ
14+
---
15+
[getting_started.md](docs/getting_started.md) and [design_guide.md](docs/design_guide.md)

build.sh

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/bin/bash
2+
trap "kill 0" EXIT
3+
4+
# Set this variable to the name of the output directory
5+
BUILD_DIR=site/public
6+
7+
WATCH=0
8+
9+
# Parsing parameters
10+
while [[ $# -gt 0 ]]; do
11+
key="$1"
12+
13+
case $key in
14+
-o | --output-dir)
15+
CUSTOM_BUILD_DIR=$2
16+
shift # past argument
17+
shift # past value
18+
;;
19+
-v | --verbose)
20+
VERBOSE=1
21+
shift
22+
;;
23+
-w | --watch)
24+
WATCH=1
25+
shift
26+
;;
27+
-h | --help)
28+
echo "Usage : $0 [options]"
29+
echo
30+
echo "Options:"
31+
echo -e " -o, --output-dir BUILD_DIR\tOutput directory"
32+
echo -e " -v, --verbose\t\tVerbose Output!"
33+
echo -e " -w, --watch\t\tWatch Mode"
34+
echo -e " -h, --help\t\tDisplay this help and exit"
35+
exit 0
36+
;;
37+
*) # unknown option
38+
POSITIONAL+=("$1") # save it in an array for later
39+
shift # past argument
40+
;;
41+
esac
42+
done
43+
echo $POSITIONAL
44+
set -- "${POSITIONAL[@]}" # restore positional parameters
45+
46+
if [[ ! -z "${CUSTOM_BUILD_DIR}" ]]; then
47+
BUILD_DIR=${CUSTOM_BUILD_DIR}
48+
fi
49+
50+
if [[ "${VERBOSE}" == "1" ]]; then
51+
echo "Creating build directories"
52+
fi
53+
mkdir -p ${BUILD_DIR}
54+
mkdir -p ${BUILD_DIR}/styles
55+
mkdir -p ${BUILD_DIR}/scripts
56+
mkdir -p ${BUILD_DIR}/resources
57+
58+
if [[ "${VERBOSE}" == "1" ]]; then
59+
echo "Copying resources and scripts"
60+
fi
61+
cp src/scripts/* ${BUILD_DIR}/scripts/ --update
62+
cp -r src/resources/* ${BUILD_DIR}/resources/ --update
63+
cp src/root/* ${BUILD_DIR}/ --update
64+
65+
if [[ "${VERBOSE}" == "1" && ! -z "${CUSTOM_BUILD_DIR}" && "${WATCH}" == "1" ]]; then
66+
echo "Updating Less Watch Compiler config"
67+
fi
68+
if [[ ! -z ${CUSTOM_BUILD_DIR} && "${WATCH}" == "1" ]]; then
69+
change_less_watch_json ${BUILD_DIR}
70+
fi
71+
72+
if [[ "${WATCH}" == "1" ]]; then
73+
if [[ "${VERBOSE}" == "1" ]]; then
74+
echo "Compiling pug -> html"
75+
pug -w src/pug/pages/ --basedir ./ --out ${BUILD_DIR}/ &
76+
else
77+
pug -s -w src/pug/pages/ --basedir ./ --out ${BUILD_DIR}/ &
78+
fi
79+
if [[ "${VERBOSE}" == "1" ]]; then
80+
echo "Starting less watch compiler"
81+
fi
82+
less-watch-compiler &
83+
if [[ "${VERBOSE}" == "1" ]]; then
84+
echo "Starting live server"
85+
live-server --verbose --port=9600 ./${BUILD_DIR} &
86+
else
87+
live-server --port=9600 ./${BUILD_DIR} &
88+
fi
89+
fi
90+
91+
if [[ "${WATCH}" == "0" ]]; then
92+
if [[ "${VERBOSE}" == "1" ]]; then
93+
echo "Compiling pug -> html"
94+
pug src/pug/pages/ --basedir ./ --out ${BUILD_DIR}/ &
95+
else
96+
pug -s src/pug/pages/ --basedir ./ --out ${BUILD_DIR}/ &
97+
fi
98+
if [[ "${VERBOSE}" == "1" ]]; then
99+
echo "Compiling less -> css"
100+
fi
101+
lessc ./src/less/index.less ${BUILD_DIR}/styles/index.css
102+
cleancss --inline all -o ${BUILD_DIR}/styles/index.min.css ${BUILD_DIR}/styles/index.css
103+
rm ${BUILD_DIR}/styles/index.css
104+
fi
105+
wait
106+
107+
# Function to change directory in less-watch-compiler.config.json
108+
change_less_watch_json() {
109+
parse_json_script=$(mktemp parse_json.XXXX.py)
110+
cat > $parse_json_script << SCRIPT
111+
#!/usr/bin/env python
112+
import json
113+
filename = "less-watch-compiler.config.json"
114+
with open(filename, 'r+') as f:
115+
jsonObject = json.load(f)
116+
jsonObject['outputFolder'] = "$1/styles"
117+
f.seek(0)
118+
json.dump(jsonObject, f, indent=4, separators=(','," : "))
119+
SCRIPT
120+
python $parse_json_script && rm $parse_json_script
121+
}

docs/design_guide.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
Directory structure
2+
---
3+
## Project Folder
4+
```
5+
├── build.sh
6+
├── docs
7+
│   ├── design_guide.md
8+
│   └── getting_started.md
9+
├── less
10+
├── less-watch-compiler.config.json
11+
├── npm_global_installs.sh
12+
├── pug
13+
│   ├── bases
14+
│   └── pages
15+
├── README.md
16+
├── resources
17+
│   ├── files
18+
│   └── images
19+
└── scripts
20+
```
21+
22+
## Final builds folder
23+
As the builds directory represents the website following directory structure should be assumed in source files.
24+
```
25+
builds/
26+
├── index.html
27+
├── pages
28+
│   └── todo.html
29+
├── resources
30+
│   ├── files
31+
│   │   └── how_to.pdf
32+
│   └── images
33+
│   └── logos
34+
│     └── iste_logo.png
35+
├── scripts
36+
│   └── es6.js
37+
└── styles
38+
└── stylesheet.css
39+
```
40+
41+
File names
42+
---
43+
File names in `snake_case` are prefered to avoid problems due to case insensitive systems such as `MacOS` and `Windows`.
44+
45+
Effects
46+
-
47+
CSS effects and animations should be prefered over `javascript` due to their sheer performance benefits.
48+
49+
Markup
50+
-
51+
Avoid code repetition by using features of `pug` and `less`
52+
53+
**Example**
54+
instead of
55+
```pug
56+
ul
57+
li 1
58+
li 2
59+
li 3
60+
li 4
61+
li 5
62+
```
63+
use
64+
```
65+
ul
66+
- var numbers = [1,2,3,4,5]
67+
each number in numbers
68+
li #{number}
69+
```
70+
Though longer, this code is easily maintainable. In case if we want to change `li` to `li.btn` this would require only one change. Also appending a new element is easier as only `js` array needs to updated.
71+
72+
73+
```pug
74+
div
75+
-
76+
var peeps = [
77+
{
78+
"name":"alpha beta",
79+
"quot":"push boys",
80+
"imag":"./resources/images/143.jpg"
81+
}
82+
//.
83+
//.
84+
//.
85+
]
86+
each peep in peeps:
87+
.space
88+
img(src=peep.imag)
89+
.name #{peep.name}
90+
.quot #{peep.quot}
91+
92+
```

docs/getting_started.md

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
TECHONOGIES
2+
---
3+
## pug
4+
Python based indentation way to easily consvert to htmal with same tags
5+
6+
## less
7+
Object oriented way of writing CSS, gets converted to CSS
8+
SETUP
9+
---
10+
Install all node packages
11+
```
12+
$ ./npm_global_installs.sh
13+
```
14+
15+
This would install global packages namely `pug, less, live-server`
16+
17+
BUILD
18+
---
19+
On `master` branch of the project run
20+
```
21+
$ ./build.sh -w
22+
```
23+
This will create a directory `site/public` in project folder.
24+
25+
**Note:** This is listener script and once your run it go ahead making changes.
26+
27+
To kill press `ctrl + C`
28+
29+
BACKEND SETUP GUIDE
30+
---
31+
On `master` branch of the project inside `site` directory run
32+
```
33+
$ npm install
34+
```
35+
this will install all the necessary packages for backend development
36+
however this does not install the database service we are using which is `MongoDB`
37+
38+
To install MongoDB follow the instruction on the following link
39+
40+
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04
41+
42+
after installation on MongoDB run the following command
43+
```
44+
$ sudo systemctl start mongodb
45+
```
46+
47+
now all the necessary packages are installed to start running the website on the `localhost` run the following command in the `site` directory
48+
```
49+
$ npm start
50+
```
51+
this will start serving the website on the local host of your computer at `port:3000` you can access the website by typing the following address to your browser
52+
`localhost:3000`
53+
this is a listener script so you can make changes to your code and just save it to restart the server
54+
55+
the entry point for backend server is the file `app.js`
56+
57+
Test for features and bugs then push the changes.
58+
59+
CONTRIBUTION
60+
---
61+
Due to bug inducing workflow experienced in the past. The workflow adopted seems to be conservative but is necessary.
62+
There are two branches of the project `master` and `gh-pages`. `master` is the main development branch where all the latest code exists. `gh-pages` branch is marked to be hosted by github and only thoroughly tested builds should be commited here.
63+
64+
All developers should volunteer to test the builds before updates to `gh-pages` branch.
65+
66+
Try to write most expressive code and avoid repetition.

index.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><html><script charset="utf-8">window.location.replace('https://istenith.com/prody');</script></html>

less-watch-compiler.config.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"watchFolder" : "src/less",
3+
"outputFolder" : "site/public/styles",
4+
"minified": true
5+
}

npm_global_installs.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
sudo npm -g install pug-cli
3+
sudo npm -g install less less-watch-compiler
4+
sudo npm -g install live-server
5+
sudo npm -g install clean-css-cli
6+
sudo npm -g install nodemon

package-lock.json

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
public/

0 commit comments

Comments
 (0)