Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static #192

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ The OncoTree is an evolving ontology and as such has gone through several iterat

For APIs, please see the [OncoTree Swagger page](http://oncotree.mskcc.org/#/home?tab=api)

## Start a frontend only website
### Install/Start project
1. Install npm globally
2. Go to web/src/main/resources/
3. Run `npm install`
4. Run `grunt serve`

## License
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
10 changes: 10 additions & 0 deletions web/src/main/resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
dist
.tmp
.sass-cache
bower_components
test
.idea
.DS_Store
target/
node/
373 changes: 373 additions & 0 deletions web/src/main/resources/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,373 @@
// Generated on 2015-10-21 using generator-angular 0.11.1
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);

// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);

var sass = require('node-sass');

// Configurable paths for the application
var appConfig = {
app: 'static',
dist: 'static/dist'
};

// Define the configuration for all the tasks
grunt.initConfig({

// Project settings
yeoman: appConfig,

// Watches files for changes and runs tasks based on the changed files
watch: {
js: {
files: ['<%= yeoman.app %>/js/{,*/}*.js'],
tasks: ['newer:eslint:all'],
options: {
livereload: '<%= connect.options.livereload %>'
}
},
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'<%= yeoman.app %>/.tmp/styles/{,*/}*.css',
]
}
},

// The actual grunt server settings
connect: {
options: {
port: 9010,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35739
},
livereload: {
options: {
open: true,
middleware: function(connect) {
return [
connect.static('.tmp'),
connect.static(appConfig.app)
];
}
}
},
dist: {
options: {
open: true,
base: '<%= yeoman.dist %>'
}
}
},

eslint: {
target: [
'Gruntfile.js',
'<%= yeoman.app %>/js/{,*/}*.js',
'test/spec/{,*/}*.js'
],
options: {
quiet: true
}
},

// Empties folders to start fresh
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/{,*/}*',
'!<%= yeoman.dist %>/.git{,*/}*'
]
}]
},
server: '.tmp'
},

// Add vendor prefixed styles
postcss: {
options: {
browsers: ['last 2 version']
},
server: {
options: {
map: true,
},
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
},
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},

// Compiles Sass to CSS and generates necessary files if requested
sass: {
options: {
implementation: sass,
sourceMap: true
},
dist: {
files: {
'.tmp/css/main.css': '<%= yeoman.app %>/css/main.scss'
}
}
},

// Renames files for browser caching purposes
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/js/{,*/}*.js',
'<%= yeoman.dist %>/css/{,*/}*.css',
'<%= yeoman.dist %>/resources/images{,*/}*.{png,png,jpeg,webp,svg}',
'<%= yeoman.dist %>/css/fonts/*'
]
}
},

// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat'],
css: ['cssmin']
},
post: {}
}
}
}
},

// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/css/{,*/}*.css'],
options: {
assetsDirs: [
'<%= yeoman.dist %>',
'<%= yeoman.dist %>/resources/files',
'<%= yeoman.dist %>/resources/images',
'<%= yeoman.dist %>/css'
]
}
},

// The following *-min tasks will produce minified files in the dist folder
// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
// cssmin: {
// dist: {
// files: {
// '<%= yeoman.dist %>/css/main.css': [
// '.tmp/css/{,*/}*.css'
// ]
// }
// }
// },
uglify: {
dist: {
files: [{
expand: true,
src: ['<%= yeoman.dist %>/js/vendor.js'],
dest: '<%= yeoman.dist %>/js/',
cwd: '.',
rename: function (dst, src) {
// To keep the source js files and make new files as `*.min.js`:
// return dst + '/' + src.replace('.js', '.min.js');
// Or to override to src:
return src;
}
}]
}
},
// concat: {
// dist: {}
// },

imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/resources/images',
src: '{,*/}*.{png,jpg,jpeg,gif,ico}',
dest: '<%= yeoman.dist %>/resources/images'
}]
}
},

svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/resources/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/resources/images'
}]
}
},

htmlmin: {
dist: {
options: {
collapseWhitespace: true,
conservativeCollapse: true,
collapseBooleanAttributes: false,
removeCommentsFromCDATA: true,
removeOptionalTags: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: ['*.html', 'views/{,*/}*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},

// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/js',
src: '*.js',
dest: '.tmp/concat/js'
}]
}
},

// Replace Google CDN references
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},

// Copies remaining files to places other tasks can use
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'*.html',
'views/{,*/}*.html',
'resources/files{,*/}*.{webp,ppt,pptx,csv,json,gif,pdf}',
'css/fonts/{,*/}*.*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/resources/images',
src: ['generated/*']
}]
}
},

// Run some tasks in parallel to speed up the build process
concurrent: {
dist: [
'sass',
'imagemin',
'svgmin'
]
},

// Test settings
karma: {
unit: {
configFile: 'test/karma.conf.js',
singleRun: true
}
}
});

grunt.registerTask('serve', 'Compile then start a connect web server', function(target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}

grunt.task.run([
'clean:server',
'postcss:server',
'connect:livereload',
'watch'
]);
});

grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function(target) {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve:' + target]);
});

grunt.registerTask('test', [
'clean:server',
'postcss',
'connect:test',
'karma'
]);

grunt.registerTask('build', [
'clean:dist',
'useminPrepare',
'concurrent:dist',
'postcss',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify:dist',
'filerev',
'usemin',
'htmlmin'
]);

grunt.registerTask('default', [
'newer:eslint',
'test',
'build'
]);
};
Loading