Commit 59124a5b authored by Christopher S Barnett's avatar Christopher S Barnett Committed by Christopher S Barnett
Browse files

updated dependencies

updated gulpfile.js to use new gulp api, add browserify task
updated README to add install and build instructions, quick link documentation
added package-lock.json
parent 13a03410
......@@ -5,10 +5,44 @@ international arms trade and broader military sector. It forms part
of WPF’s ongoing program on the Global Arms Trade and Corruption.
___
## quick links to countries and cases
You can link directly to a country or a case with a URI fragment.
The query string for a country is the 3 letter ISO code.
```shell
/index.html#country=SWE
```
The query string for a case is the URL encoded case name.
```shell
/index.html#deal=The%20South%20African%20Arms%20Deal
```
## Install and build javascript
Build javascript by running gulpfile.js. Browserify is used to create
a javascript bundle.
requires Node, npm and gulp cli. See the gulp.js quickstart for information.
https://gulpjs.com/docs/en/getting-started/quick-start
### To install:
Navigate to the project directory.
To install javascript dependencies:
```shell
npm install
```
To build the javascript file:
```shell
gulp
```
___
The arms deal data for the map is found in `docroot/data/wpf_deals.json`
......
This diff is collapsed.
......@@ -36,7 +36,7 @@
<link rel="stylesheet" href="css/leaflet.css"/>
<link rel="stylesheet" href="css/map.css"/>
<!-- Bootstrap Core JavaScript -->
<!-- Application JavaScript -->
<script src="dist/js/app.js"></script>
</head>
......
"use strict";
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
var browserify = require("browserify");
var gulp = require("gulp");
var source = require("vinyl-source-stream");
var buffer = require("vinyl-buffer");
var uglify = require("gulp-uglify");
var gutil = require("gulp-util");
gulp.task("javascript", function () {
// set up the browserify instance on a task basis
var b = browserify({
entries: "./js/map.js",
debug: true
});
gulp.task('browserify', function() {
return browserify('./js/map.js')
.bundle()
//Pass desired output filename to vinyl-source-stream
.pipe(source('app.js'))
// Start piping stream to tasks!
.pipe(gulp.dest('./js/'));
});
return b.bundle()
.pipe(source("app.js"))
.pipe(buffer())
// Add transformation tasks to the pipeline here.
gulp.task('compress', function() {
return gulp.src('./js/app.js')
.pipe(uglify())
.on("error", gutil.log)
.pipe(gulp.dest("./docroot/dist/js/"));
.pipe(gulp.dest('./docroot/dist/js/'));
});
gulp.task('default', gulp.series('browserify', 'compress'));
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment