Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (20)
image: node:6.6.0
image: node:21.2.0
pages:
stage: deploy
script:
- npm install
- npm run install
- npm run build
artifacts:
paths:
- public
......
......@@ -7,76 +7,15 @@
## Presteps
1. Install Node ( Welcome to the world of Node <3 )
2. run `npm install -g gulp-cli`
## Installation
1. `npm install` from root folder
## Running the application
* `gulp serve` - starts a local server and keeps watching the file changes
### Under the Hood!
Okay, Let's look at it one by one.
We installed [Node](https://nodejs.org/en/) so that we can use [Grunt](https://gruntjs.com) ( The super awesome javascript task runnner).
But why do we even need a task runner? I'm sure you guys had fun at Selenium workshop, automating things. Grunt helps you automate a lot of things.
Now, take a look at package.json file. You'll see a lot of grunt-* dependencies each serving a special purpose in your project. eg. `grunt-contrib-concat` is for concatenating files.
Now, `Gruntfile.js`: This is where you configure/define your grunt tasks. Let's see what all things are defined there now.
Look at jshint
```
jshint: {
main: {
files : [{
src : ['Gruntfile.js', 'js/**/*.js']
}]
},
options: {
globals: {
'jQuery': true,
'angular': true,
'console': true,
'$': true,
'_': true,
'moment': true
}
}
},
```
Here `main` corresponds to a subtask. That means you run this task as `grunt jshint:main`. `grunt jshint`, as you would expect, will run all the subtasks associated with jshint(In this case we've only one, ie `main`)
Now, what does this `jshint:main` task do?
It checks all the files (ie,`Gruntfile.js` and all the javascript files within js folder) for syntax errors.
Similarly we've htmlhint, [pug](https://pugjs.org/) and concat.
Now the cool part! `watch` is the task which lets you watch different files for changes and runs associated task whenever some change happens.
for example,
```
js: {
files: 'js/**',
options: {
nospawn: true,
livereload: true
},
tasks: ['jshint', 'concat']
},
```
This portion inside `watch` configures `jshint` and `uglify` to be run whenever files inside js folder (`js/**`) changes.
Is that a lot to take in?
Just one more! `connect` task starts a local server at [http://localhost:8080](http://localhost:8080). It also inject a script to your page that keeps a live connection to the server, so that browser will automatically refresh whenever you change and save code. Doesn't that sound awesome to you?
Let us know ;)
## Building
1. `npm run build`
## License
......
echo "Processing assets"
mkdir -p public/fonts public/img
cp node_modules/bootstrap/fonts/*.{ttf,woff,eot,svg,woff2} node_modules/font-awesome/fonts/*.{ttf,woff,eot,svg,woff2,otf} fonts/*.{ttf,woff,woff2} node_modules/bootcards/dist/fonts/*.{ttf,woff,eot,svg,woff2,otf} public/fonts
cp node_modules/leaflet/dist/images/** img/** public/img
npx pug pug/pages --out public
echo "Processing events"
mkdir -p public/events
echo "events:" > public/events/index.yaml
for f in $(ls -r events/details); do
event=$(basename $f .yaml)
echo "Processing $event"
echo " $event:" >> public/events/index.yaml
cat "events/details/$f" | sed 's/^/ /' >> public/events/index.yaml
if ! [ -f public/events/$event.html ]; then
npx js-yaml "events/details/$f" > "public/events/$event.json"
npx pug -O public/events/$event.json pug/templates/individual_event_page.pug
mv pug/templates/individual_event_page.html public/events/$event.html
fi
done
npx js-yaml public/events/index.yaml > public/events/index.json
npx pug -O public/events/index.json pug/templates/events.pug
mv pug/templates/events.html public/events/index.html
echo "Processing CSS"
mkdir -p public/css
cat 'node_modules/bootstrap/dist/css/bootstrap.min.css' 'node_modules/font-awesome/css/font-awesome.min.css' 'node_modules/leaflet/dist/leaflet.css' 'node_modules/bootcards/dist/css/bootcards-desktop.min.css' css/*.css | npx postcss > public/css/index.css
echo "Processing JS"
mkdir -p public/js
npx uglify-js 'node_modules/jquery/dist/jquery.min.js' 'node_modules/bootstrap/dist/js/bootstrap.min.js' 'node_modules/leaflet/dist/leaflet.js' 'node_modules/bootcards/dist/js/bootcards.min.js' 'js/*.js' -o public/js/index.js
\ No newline at end of file
var gulp = require('gulp');
var htmlhint = require('gulp-htmlhint');
var jshint = require('gulp-jshint');
var csslint = require('gulp-csslint');
var pug = require('gulp-pug');
var concat = require('gulp-concat');
var cssmin = require('gulp-cssmin');
var uglify = require('gulp-uglify');
var connect = require('gulp-connect');
var connectProxy = require('gulp-connect-proxy');
var yamlinc = require('gulp-yaml-include');
var runSequence = require('run-sequence');
var readYaml = require('read-yaml');
var glob = require('glob');
var yaml = require('gulp-yaml');
var sortJSON = require('gulp-json-sort').default;
var fs = require('fs');
gulp.task('assetscopy', function() {
gulp.src([
'node_modules/bootstrap/fonts/*.{ttf,woff,eot,svg, woff2}',
'node_modules/font-awesome/fonts/*.{ttf,woff,eot,svg,woff2,otf}',
'fonts/*.{ttf,woff,woff2}',
'node_modules/bootcards/dist/fonts/*.{ttf,woff,eot,svg,woff2,otf}'
]).pipe(gulp.dest('public/fonts'));
gulp.src([
'node_modules/leaflet/dist/images/**',
'img/**'
]).pipe(gulp.dest('public/img'));
});
gulp.task('htmllint', function() {
gulp.src("public/*.html")
.pipe(htmlhint());
});
gulp.task('csslint', function() {
gulp.src('css/*.css')
.pipe(csslint({
'shorthand': false
}))
.pipe(csslint.formatter());
});
gulp.task('jslint', function() {
gulp.src(["gulpfile.js", "js/*.js"])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('GenerateIndexPage', function() {
gulp.src('pug/pages/*.pug')
.pipe(pug({
pretty: true,
data: {
debug: true
}
}))
.pipe(gulp.dest('public'));
});
gulp.task('GenerateEventsYAML', function() {
return gulp.src("events/index.yaml")
.pipe(yamlinc())
.pipe(gulp.dest('public/events'));
});
gulp.task('GenerateEventsJSON', function() {
return gulp.src('public/events/index.yaml')
.pipe(yaml())
.pipe(sortJSON({
cmp: function(a, b) {
return a.key < b.key ? 1 : -1;
},
space: 2
}))
.pipe(gulp.dest('public/events'))
});
gulp.task('GenerateEventsIndex', function() {
fs.readFile('./public/events/index.json', "utf-8", function(err, sortedEvents){
if(err){
throw err;
}
gulp.src('pug/templates/events.pug')
.pipe(pug({
pretty: true,
data: {
debug: true,
events: JSON.parse(sortedEvents)
}
}))
.pipe(concat('index' + '.html'))
.pipe(gulp.dest('public/events'));
});
});
gulp.task('GenerateEventPages', function() {
glob("events/details/*.yaml", {}, function(er, files) {
var nooffiles = files.length;
for (var i = 0; i < nooffiles; i++) {
readYaml(files[i], function(err, ydata) {
if (err) throw err;
var id = ydata.id;
gulp.src('pug/templates/individual_event_page.pug')
.pipe(pug({
pretty: true,
data: {
debug: true,
evt: ydata
}
}))
.pipe(concat(id + '.html'))
.pipe(gulp.dest('public/events'));
});
}
});
});
gulp.task('pughtml', function() {
runSequence(
['GenerateIndexPage', 'GenerateEventPages'],
'GenerateEventsYAML',
'GenerateEventsJSON',
'GenerateEventsIndex'
)
});
gulp.task('cssmin', function() {
gulp.src([
'node_modules/bootstrap/dist/css/bootstrap.min.css',
'node_modules/font-awesome/css/font-awesome.min.css',
//'node_modules/normalize.css/normalize.css',
'node_modules/leaflet/dist/leaflet.css',
'node_modules/bootcards/dist/css/bootcards-desktop.min.css',
// 'node_modules/bootcards/dist/css/bootcards-android.min.css',
// 'node_modules/bootcards/dist/css/bootcards-ios.min.css',
'css/*.css'
])
.pipe(concat('index.css'))
.pipe(cssmin())
.pipe(gulp.dest('public/css'));
});
gulp.task('jsuglify', function() {
gulp.src([
'node_modules/jquery/dist/jquery.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/leaflet/dist/leaflet.js',
'node_modules/bootcards/dist/js/bootcards.min.js',
'js/*.js'
])
.pipe(concat('index.js'))
.pipe(uglify())
.pipe(gulp.dest('public/js'));
gulp.src([
'node_modules/html5shiv/dist/html5shiv.js',
'node_modules/Respond.js/src/respond.js'
])
.pipe(uglify())
.pipe(gulp.dest('public/js'));
});
gulp.task('verify', [
'public',
'htmllint',
'csslint',
'jslint'
]);
gulp.task('public', [
'assetscopy',
'pughtml',
'cssmin',
'jsuglify'
]);
gulp.task('connect', function() {
connect.server({
root: 'public',
port: 8080,
livereload: true
});
});
gulp.task('watch', function() {
gulp.watch([
'./pug/**/*.pug'
], [
'pughtml',
'htmllint',
]);
gulp.watch([
'css/*.css',
'package.json'
], [
'csslint',
'cssmin'
]);
gulp.watch([
'js/*.js',
'package.json'
], [
'jslint',
'jsuglify',
]);
});
gulp.task('serve', [
'public',
'connect',
'watch'
]);
gulp.task('default', [
'serve'
]);
......@@ -47,7 +47,7 @@ var locations = [{
"TITLE": "dgplug (Linux Users' Group of Durgapur)",
"URL": "https://www.dgplug.org/",
"MLIST": "http://lists.dgplug.org/listinfo.cgi/users-dgplug.org",
"MATURL": "https://matrix.to/#/#freenode_#dgplug:matrix.org",
"MATURL": "https://matrix.to/#/#dgplug:libera.chat",
"TGURL": ""
}, {
"LAT": "18.975",
......@@ -210,8 +210,8 @@ var locations = [{
"MATURL": "",
"TGURL": ""
}, {
"LAT": "28.6140",
"LNG": "77.2090",
"LAT": "28.7140",
"LNG": "77.3000",
"TITLE": "NDBUG (New Delhi BSD User Group)",
"URL": "http://ndbug.in",
"MLIST": "",
......@@ -241,4 +241,54 @@ var locations = [{
"MLIST": "",
"MATURL": "https://riot.im/app/#/room/#bsd:matrix.org",
"TGURL": "https://t.me/unitedbsd"
}, {
"LAT":" 10.62655",
"LNG": "76.14496",
"TITLE": "FOSSers VAST",
"URL": "http://fossers.vidyaacademy.ac.in",
"MLIST": "https://lists.fsci.org.in/postorius/lists/fossersvast.lists.fsci.org.in",
"MATURL": "https://matrix.to/#/#FOSSersVAST:matrix.org",
"TGURL": "https://t.me/fossersvast"
}, {
"LAT":"11.93855",
"LNG": "79.4984801",
"TITLE": "Viluppuram GLUG",
"URL": "https://vglug.org",
"MLIST": "https://groups.google.com/forum/#!forum/viluppuramglug",
"MATURL": "https://matrix.to/#/+vglug:matrix.org",
"TGURL": ""
}, {
"LAT": "28.6129",
"LNG": "77.2277",
"TITLE": "PyDelhi",
"URL": "https://pydelhi.org/",
"MLIST": "https://mail.python.org/mailman/listinfo/ncr-python.in",
}, {
"LAT": "28.6328",
"LNG": "77.2195",
"TITLE": "Mozilla Delhi",
"URL": "https://wiki.mozilla.org/India/Delhi",
"TGURL": "https://t.me/mozilladelhi",
}, {
"LAT": "28.4653",
"LNG": "77.5106",
"TITLE": "Greater Noida Developer Group",
"URL": "http://www.gndg.in/",
"TGURL": "https://t.me/joinchat/AoNm4T5dyUMR40KBgwuF8w",
}, {
"LAT":"9.727128",
"LNG": "76.726013",
"TITLE": "The Nexus, SJCET Palai (Free Software and Hardware Users Group/Club) ",
"URL": "https://github.com/thenexusproject",
"MLIST": "",
"MATURL": "",
"TGURL": ""
}, {
"LAT":"12.991829015583626",
"LNG": "80.22862809291958",
"TITLE": "ILUGC (Indian Linux User Group - Chennai)",
"URL": "https://ilugc.in",
"MLIST": "https://www.freelists.org/list/ilugc",
"MATURL": "https://matrix.to/#/#ilugc:libera.chat",
"TGURL": ""
}];
\ No newline at end of file
This diff is collapsed.
......@@ -10,32 +10,19 @@
},
"homepage": "https://fsug.in",
"devDependencies": {
"connect-livereload": "^0.5.4",
"fs": "0.0.1-security",
"glob": "^7.1.2",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",
"gulp-connect": "^5.0.0",
"gulp-connect-proxy": "^0.3.1",
"gulp-csslint": "^1.0.0",
"gulp-cssmin": "^0.2.0",
"gulp-htmlhint": "^0.3.1",
"gulp-jshint": "^2.0.4",
"gulp-json-sort": "^1.0.0",
"gulp-pug": "^3.3.0",
"gulp-uglify": "^3.0.0",
"gulp-yaml": "^1.0.1",
"gulp-yaml-data": "^0.2.0",
"gulp-yaml-include": "^0.2.0",
"read-yaml": "^1.1.0",
"run-sequence": "^1.2.2"
"csslint": "^1.0.5",
"cssnano": "^6.0.1",
"htmlhint": "^1.1.4",
"js-yaml": "^4.1.0",
"jshint": "^2.13.6",
"postcss-cli": "^10.1.0",
"pug-cli": "^1.0.0-alpha6",
"uglify-js": "^3.17.4"
},
"dependencies": {
"Respond.js": "git+https://github.com/scottjehl/Respond.git#1.4.0",
"bootcards": "git+https://github.com/bootcards/bootcards.git",
"bootstrap": "^3.3.7",
"font-awesome": "^4.7.0",
"html5shiv": "^3.7.0",
"jquery": "2.2.4",
"leaflet": "^1.0.3",
"normalize.css": "^7.0.0"
......@@ -43,6 +30,6 @@
"author": "FSCI - Free Software Community of India <fosscommunity.in@disroot.org>",
"license": "GPL-3.0",
"scripts": {
"install": "gulp public"
"build": "sh build.sh"
}
}
module.exports = {
plugins: [
require('cssnano')({
preset: 'default',
}),
],
};
\ No newline at end of file
......@@ -30,7 +30,7 @@ block content
// panel body
.list-group
// list of sample data
for event in events.events
for event in events
a.list-group-item.events-list.separator(href='/events/' + event.id + '.html')
img.img-rounded.pull-left(src=event.imgurl)
h4.list-group-item-heading= event.name
......
......@@ -41,24 +41,24 @@ block content
.list-group
.list-group-item.separator-top
label= "NAME"
h4.list-group-item-heading= evt.name
h4.list-group-item-heading= name
.list-group-item.separator
label= "LOCATION"
if (evt.lat != "" && evt.lng != "")
a(href="http://www.openstreetmap.org/?mlat=" + evt.lat + "&mlon=" + evt.lng + "&ref=FSCI")
h4.list-group-item-heading= evt.venue + ', ' + evt.district
if (lat != "" && lng != "")
a(href="http://www.openstreetmap.org/?mlat=" + lat + "&mlon=" + lng + "&ref=FSCI")
h4.list-group-item-heading= venue + ', ' + district
else
h4.list-group-item-heading= evt.venue + ', ' + evt.district
h4.list-group-item-heading= venue + ', ' + district
.list-group-item.separator
label= "ORGANIZED BY"
h4.list-group-item-heading= evt.organizedby
h4.list-group-item-heading= organizedby
.list-group-item.separator
label= "DATETIME"
h4.list-group-item-heading= evt.when
if (evt.contactinfo != "")
h4.list-group-item-heading= when
if (contactinfo != "")
.list-group-item.separator
label= "CONTACT INFO"
h4.list-group-item-heading= evt.contactinfo
h4.list-group-item-heading= contactinfo
#description-card.event-card.col-sm-8
.panel.panel-default.bootcards-richtext.event-details
......@@ -66,6 +66,6 @@ block content
h3.panel-title Description
a.btn.btn-primary.pull-right(href='http://fsci.org.in/events')
span Back
.panel-body!= evt.description
.panel-body!= description
p.lead
img(src=evt.imgurl, alt=evt.name)
img(src=imgurl, alt=name)
npx htmlhint public/*.html
npx csslint css/*.css
npx jshint js/*.js
\ No newline at end of file