Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bowerrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"directory": "src/bower_components"
"directory": "src"
}
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
node_modules
bower_components
/.idea/
src/dijit
src/dojo
src/dojox
src/esri
src/util
src/dgrid
src/put-selector
src/xstyle
src/bootstrap-map-js
src/dojo-bootstrap
dist
.grunt
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
# dojo-bootstrap-map-js

A boilerplate application demonstrating how to use the Esri [ArcGIS API for JavaScript](//js.arcgis.com) with [Bootstrap Map](//github.com/Esri/bootstrap-map-js) and [Dojo Bootstrap](//github.com/xsokev/Dojo-Bootstrap) to create a responsive mapping application using [Bootstrap](//getbootstrap.com) components without a dependency on jQuery.
An application boilerplate demonstrating how to use the Esri [ArcGIS API for JavaScript](//js.arcgis.com) with [Bootstrap Map](//github.com/Esri/bootstrap-map-js) and [Dojo Bootstrap](//github.com/xsokev/Dojo-Bootstrap) to create a responsive mapping application using [Bootstrap](//getbootstrap.com) components.

[View it live](http://esri.github.io/dojo-bootstrap-map-js/src/)
[View it live](http://esri.github.io/dojo-bootstrap-map-js/)

![App Screenshot](https://raw.githubusercontent.com/Esri/dojo-bootstrap-map-js/master/dojo-bootstrap-map-js.png)

The goal of this application boilerplate is to demonstrate how to build a mapping application that utilizes the best parts of Dojo (AMD modules, classes and widgets, promises, i18n, routing, etc) along with the responsive UI of Bootstrap. NOTE: not all of the above have been incorporated into this boilerplate yet.
This boilerplate is ideal for mobile applications because it provides the responsive UI of Bootstrap without the overhead of loading all of jQuery. Furthermore, you can run a Dojo build to optimize all of the JavaScript and CSS source code and dependencies to get a roughly 95% reduction in number of requests for scripts and 25% reduction in the size of those scripts.

For simpler examples of how to get started with [Bootstrap Map](//github.com/Esri/bootstrap-map-js) and [Dojo Bootstrap](//github.com/xsokev/Dojo-Bootstrap), see the [Boostrap Map demo pages](http://esri.github.io/bootstrap-map-js/demo/dojo/getstarted.html).
This application boilerplate demonstrates how to build a mapping application that utilizes the best parts of Dojo (AMD modules, classes and widgets, promises, i18n, custom builds, etc) along with the responsive UI of Bootstrap. For simpler examples of how to get started with [Bootstrap Map](//github.com/Esri/bootstrap-map-js) and [Dojo Bootstrap](//github.com/xsokev/Dojo-Bootstrap), see the [Boostrap Map demo pages](http://esri.github.io/bootstrap-map-js/demo/dojo/getstarted.html).

## Instructions

By default, this boilerplate assumes you will want to work from local copies of all dependencies so that you can create a custom build. However, you can also work off of remotely hosted (CDN) dependencies by using `nobuild.html`.

### Quick Start

1. [Download](https://github.com/Esri/dojo-bootstrap-map-js/archive/master.zip) or [Fork and clone the repo](https://help.github.com/articles/fork-a-repo)
2. Make sure the `dojo-bootstrap-map-js` folder is served via your local web server
3. Load `src/nobuild.html` in your browser

### Downloading Dependencies and Building

You will need to install [Node](http://nodejs.org/), [Bower](http://bower.io/), and [Grunt](http://gruntjs.com/) in order to download dependencies and build the app via the command line.

1. [Fork and clone the repo](https://help.github.com/articles/fork-a-repo)
2. `cd` into the `dojo-bootstrap-map-js` folder
3. Run `bower install`
4. Run and try the samples.
3. Run `bower install` to download Dojo and other dependencies
4. Run `npm install` to install the Grunt tasks
5. Run `grunt slurp` to download the Esri JSAPI
6. Run `grunt serve` to load the unbuilt app into a web browser
7. Modify the code as needed
8. Run `grunt build` to build the app under the `dist` folder

You can then browse to the `dist` folder to view the built app. You may want to run `grunt clean:deploy` to remove all uncompressed javascript and source maps before you deploy the contents of that folder to your web server.

## Requirements

* Notepad or your favorite text editor
* Web browser with access to the Internet
* Node and Grunt if you want to use the command line development tools
* [Node](http://nodejs.org/), [Bower](http://bower.io/), and [Grunt](http://gruntjs.com/) to run the command line development tools

## Resources

Expand Down
11 changes: 9 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dojo-bootstrap-map-js",
"version": "3.1.2",
"version": "3.1.3",
"homepage": "https://github.com/Esri/dojo-bootstrap-map-js",
"authors": [
"Tom Wayson <[email protected]>"
Expand All @@ -22,6 +22,13 @@
],
"dependencies": {
"bootstrap-map-js": "~0.0.2",
"dojo-bootstrap": "~3.0.2"
"dojo-bootstrap": "~3.0.2",
"dijit": "#1.9.1",
"dojo": "#1.9.1",
"dojox": "#1.9.1",
"util": "dojo-util#1.9.1",
"dgrid": "#0.3.14",
"put-selector": "#0.3.5",
"xstyle": "#0.1.3"
}
}
118 changes: 103 additions & 15 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
return connect['static'](require('path').resolve(dir));
};
module.exports = function(grunt) {

Expand All @@ -13,7 +13,7 @@ module.exports = function(grunt) {
options: {
jshintrc: true
},
all: ['src/js/**/*.js']
all: ['src/app/**/*.js']
},

bower: {
Expand Down Expand Up @@ -76,25 +76,110 @@ module.exports = function(grunt) {
]
}
},
buildGhPages: {
ghPages: {
// Leave empty if you just want to run the defaults
esri_slurp: {
options: {
version: '3.11'
},
dev: {
options: {
beautify: true
},
dest: 'src/esri'
}
},
});

// clean the output directory before each build
clean: {
build: ['dist'],
deploy: ['dist/**/*.consoleStripped.js','dist/**/*.uncompressed.js','dist/**/*.js.map']
},
// dojo build configuration, mainly taken from dojo boilerplate
dojo: {
dist: {
options: {
profile: 'profiles/app.profile.js' // Profile for build
}
},
options: {
dojo: 'src/dojo/dojo.js', // Path to dojo.js file in dojo source
load: 'build', // Optional: Utility to bootstrap (Default: 'build')
// profiles: [], // Optional: Array of Profiles for build
// appConfigFile: '', // Optional: Config file for dojox/app
// package: '', // Optional: Location to search package.json (Default: nothing)
// packages: [], // Optional: Array of locations of package.json (Default: nothing)
// require: '', // Optional: Module to require for the build (Default: nothing)
// requires: [], // Optional: Array of modules to require for the build (Default: nothing)
releaseDir: '../dist', // Optional: release dir rel to basePath (Default: 'release')
cwd: './', // Directory to execute build within
// dojoConfig: '', // Optional: Location of dojoConfig (Default: null),
// Optional: Base Path to pass at the command line
// Takes precedence over other basePaths
// Default: null
basePath: './src'
}
},
// this copies over index.html and replaces
// the perl regexp section of build.sh in the dojo boilerplate
'string-replace': {
index: {
src: './src/index.html',
dest: './dist/index.html',
options: {
replacements: [
// remove isDeubug
{
pattern: /isDebug: *true,/,
replacement: ''
},
// strip js comments
{
pattern: /\s+\/\/.*$/gm,
replacement: ''
},
// replace newlines w/ whitespace
{
pattern: /\n/g,
replacement: ' '
},
// strip html comments
{
pattern: /<!--[\s\S]*?-->/g,
replacement: ''
},
// collapse whitespace
{
pattern: /\s+/g,
replacement: ' '
}
]
}
}
},
copy: {
build: {
src: './src/nobuild.html',
dest: './dist/nobuild.html'
}
},
'gh-pages': {
options: {
base: 'dist'
},
src: ['**']
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-build-gh-pages');

grunt.registerTask('default', ['watch']);
grunt.loadNpmTasks('grunt-gh-pages');
grunt.loadNpmTasks('grunt-esri-slurp');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-dojo');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-contrib-copy');

grunt.registerTask('default', [
'serve'
]);
grunt.registerTask('default', ['serve']);

grunt.registerTask('serve', function (target) {
grunt.task.run([
Expand All @@ -107,6 +192,9 @@ module.exports = function(grunt) {

grunt.registerTask('hint', ['jshint']);

grunt.registerTask('gh-pages', ['buildGhPages:ghPages']);
grunt.registerTask('slurp', ['esri_slurp:dev']);

grunt.registerTask('build', ['jshint', 'clean:build', 'dojo', 'string-replace', 'copy:build']);

};
grunt.registerTask('deploy', ['clean:deploy', 'gh-pages']);
};
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dojo-bootstrap-map-js",
"version": "3.1.2",
"version": "3.1.3",
"description": "A boilerplate application demonstrating how to create a responsive mapping application using the Esri ArcGIS API for JavaScript with Bootstrap Map and Dojo Bootstrap",
"main": "gruntfile.js",
"directories": {
Expand All @@ -27,10 +27,12 @@
{
"name": "alaframboise",
"homepage": "https://github.com/alaframboise"
}, {
},
{
"name": "benstoltz",
"homepage": "https://github.com/benstoltz"
}, {
},
{
"name": "tsamaya",
"homepage": "https://github.com/tsamaya"
}
Expand All @@ -45,10 +47,16 @@
"grunt": "~0.4.2",
"grunt-bower-task": "~0.3.4",
"grunt-build-gh-pages": "^1.0.3",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-connect": "~0.7.1",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-open": "~0.2.3"
"grunt-dojo": "^0.3.0",
"grunt-esri-slurp": "^1.1.0",
"grunt-gh-pages": "^0.9.1",
"grunt-open": "~0.2.3",
"grunt-string-replace": "^0.2.7"
},
"engines": {
"node": ">=0.8.0"
Expand Down
Loading