From d6bd82dc3e2eb8e1819e191ae3b909ee574c55fe Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Thu, 2 Oct 2014 23:44:04 +0200 Subject: [PATCH] Removed CDN dependencies for JS --- gruntfile.js | 25 ++++++++++++++++++++----- package.json | 10 +++++++++- public_html/.gitignore | 1 + public_html/index.html | 12 ++++++------ public_html/js/Bootstrap.js | 2 +- 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index 3e5fcd41..4e291fca 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -1,12 +1,14 @@ var path = require('path'); var fs = require('fs'); var ini = require('ini'); +var rmdir = require('rimraf'); var phpCheckStyleConfigPath = path.join(path.resolve(), 'phpcheckstyle.cfg'); var phpSourcesDir = path.join(path.resolve(), 'src'); -var jsSourcesDir = path.join(path.resolve(), 'public_html/js'); -var cssSourcesDir = path.join(path.resolve(), 'public_html/css'); -var templatesDir = path.join(path.resolve(), 'public_html/templates'); +var publicHtmlDir = path.join(path.resolve(), 'public_html'); +var jsSourcesDir = path.join(publicHtmlDir, 'js'); +var cssSourcesDir = path.join(publicHtmlDir, 'css'); +var templatesDir = path.join(publicHtmlDir, 'templates'); var config = readConfig([ path.join(path.resolve(), 'data/config.ini'), @@ -87,6 +89,18 @@ module.exports = function(grunt) { }, }, + copy: { + dist: { + files: [ + { src: 'node_modules/jquery/dist/jquery.min.js', dest: 'public_html/lib/jquery.min.js' }, + { src: 'node_modules/jquery.cookie/jquery.cookie.js', dest: 'public_html/lib/jquery.cookie.js' }, + { src: 'node_modules/mousetrap/mousetrap.min.js', dest: 'public_html/lib/mousetrap.min.js' }, + { src: 'node_modules/pathjs/path.js', dest: 'public_html/lib/path.js' }, + { src: 'node_modules/underscore/underscore-min.js', dest: 'public_html/lib/underscore.min.js' }, + ] + } + }, + cssmin: { combine: { files: { @@ -134,8 +148,9 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-shell'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.registerTask('default', ['checkstyle', 'tests']); + grunt.registerTask('default', ['copy:dist', 'checkstyle', 'tests']); grunt.registerTask('checkstyle', ['jshint', 'shell:phpcheckstyle']); grunt.registerTask('tests', ['shell:tests']); grunt.registerTask('update', ['shell:upgrade']); @@ -147,6 +162,6 @@ module.exports = function(grunt) { fs.unlink('public_html/app.min.js.map'); fs.unlink('public_html/app.min.css'); }); - grunt.registerTask('build', ['clean', 'uglify', 'cssmin', 'processhtml']); + grunt.registerTask('build', ['clean', 'copy:dist', 'uglify', 'cssmin', 'processhtml']); }; diff --git a/package.json b/package.json index 976ba8ba..ef80a2fd 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,12 @@ "name": "szuru2", "version": "0.0.0", "dependencies": { + "pathjs": "~0.8.1", + "jquery.cookie": "1.4.1", + "jquery": "~2.1.1", + "underscore": "1.7.0", + "mousetrap": "0.0.1", + "requirejs": "*", "ini": "*", "grunt": "~0.4.5", @@ -9,7 +15,9 @@ "grunt-contrib-uglify": "*", "grunt-contrib-cssmin": "*", "grunt-contrib-jshint": "~0.10.0", + "grunt-contrib-copy": "*", "grunt-shell": "~1.1.1", - "grunt-cli": "*" + "grunt-cli": "*", + "rimraf": "~2.1" } } diff --git a/public_html/.gitignore b/public_html/.gitignore index db7b7253..ccc4bf64 100644 --- a/public_html/.gitignore +++ b/public_html/.gitignore @@ -2,3 +2,4 @@ app.min.html app.min.js app.min.js.map app.min.css +lib diff --git a/public_html/index.html b/public_html/index.html index 8d82a868..377b499d 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -8,17 +8,17 @@ - - - - - + + + + + - + diff --git a/public_html/js/Bootstrap.js b/public_html/js/Bootstrap.js index 0e1efd7e..3b9c39d7 100644 --- a/public_html/js/Bootstrap.js +++ b/public_html/js/Bootstrap.js @@ -27,7 +27,7 @@ App.Bootstrap = function(auth, router, util, promise, presenterManager) { App.DI.registerSingleton('bootstrap', ['auth', 'router', 'util', 'promise', 'presenterManager'], App.Bootstrap); App.DI.registerManual('jQuery', function() { return window.$; }); -App.DI.registerManual('pathJs', function() { return window.Path; }); +App.DI.registerManual('pathJs', function() { return window.pathjs; }); App.DI.registerManual('_', function() { return window._; }); App.DI.registerManual('mousetrap', function() { return window.Mousetrap; }); App.DI.get('bootstrap');