diff --git a/app/Library/Assets.php b/app/Library/Assets.php index 3c2dde35..8a423307 100644 --- a/app/Library/Assets.php +++ b/app/Library/Assets.php @@ -20,23 +20,6 @@ class Assets { - public static function scriptIncludes($area = 'app') - { - if (!Config::get("app.debug")) { - return ''; - } - - $scripts = self::mergeGlobs(self::getScriptsForArea($area)); - $retVal = ""; - - foreach ($scripts as $script) { - $filename = self::replaceExtensionWith($script, ".coffee", ".js"); - $retVal .= ""; - } - - return $retVal; - } - public static function styleIncludes($area = 'app') { if (!Config::get("app.debug")) { @@ -84,41 +67,6 @@ class Assets return $files; } - private static function getScriptsForArea($area) - { - if ($area == 'app') { - return [ - "scripts/base/jquery-2.0.2.js", - "scripts/base/angular.js", - "scripts/base/marked.js", - "scripts/base/*.{coffee,js}", - "scripts/shared/*.{coffee,js}", - "scripts/app/*.{coffee,js}", - "scripts/app/services/*.{coffee,js}", - "scripts/app/filters/*.{coffee,js}", - "scripts/app/directives/*.{coffee,js}", - "scripts/app/controllers/*.{coffee,js}", - "scripts/**/*.{coffee,js}" - ]; - } else { - if ($area == 'embed') { - return [ - "scripts/base/jquery-2.0.2.js", - "scripts/base/jquery.cookie.js", - "scripts/base/jquery.viewport.js", - "scripts/base/underscore.js", - "scripts/base/moment.js", - "scripts/base/jquery.timeago.js", - "scripts/base/soundmanager2-nodebug.js", - "scripts/shared/jquery-extensions.js", - "scripts/embed/*.coffee" - ]; - } - } - - throw new Exception(); - } - private static function getStylesForArea($area) { if ($area == 'app') { diff --git a/gulpfile.js b/gulpfile.js index 89e62361..021c3417 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -25,7 +25,8 @@ var gulp = require("gulp"), WebpackDevServer = require("webpack-dev-server"), webpackDevConfig = require("./webpack.dev.config.js"), webpackProductionConfig = require("./webpack.production.config.js"), - webpackStream = require('webpack-stream'); + webpackStream = require('webpack-stream'), + _ = require("underscore"); var plumberOptions = { errorHandler: plug.notify.onError("Error: <%= error.message %>") @@ -55,7 +56,7 @@ var licenseHeader = [ gulp.task("webpack-build", function() { - return gulp.src(webpackProductionConfig.entry) + return gulp.src(_.values(webpackProductionConfig.entry)) .pipe(webpackStream(webpackProductionConfig)) .pipe(header(licenseHeader)) .pipe(gulp.dest('public')); @@ -78,33 +79,6 @@ gulp.task("webpack-dev-server", function () { }); -gulp.task("scripts-embed", function () { - // note that this task should really only ever be invoked for production - // since development-mode watches and builds include the embed scripts - // already - - var includedScripts = [ - "resources/assets/scripts/base/jquery-2.0.2.js", - "resources/assets/scripts/base/jquery.cookie.js", - "resources/assets/scripts/base/jquery.viewport.js", - "resources/assets/scripts/base/underscore.js", - "resources/assets/scripts/base/moment.js", - "resources/assets/scripts/base/jquery.timeago.js", - "resources/assets/scripts/base/soundmanager2-nodebug.js", - "resources/assets/scripts/shared/jquery-extensions.js", - "resources/assets/scripts/embed/*.coffee" - ]; - - return gulp.src(includedScripts, {base: "resources/assets/scripts"}) - .pipe(plug.plumber(plumberOptions)) - .pipe(plug.if(/\.coffee/, plug.coffee())) - .pipe(plug.order(includedScripts, {base: "."})) - .pipe(plug.concat("embed.js")) - .pipe(plug.uglify()) - .pipe(header(licenseHeader)) - .pipe(gulp.dest("public/build/scripts")); -}); - gulp.task("styles-app", function () { var includedStyles = [ "resources/assets/styles/base/jquery-ui.css", @@ -194,7 +168,6 @@ gulp.task('build', [ 'webpack-build', 'copy:templates', 'styles-app', - 'scripts-embed', 'styles-embed' ]); diff --git a/resources/assets/scripts/app/app.coffee b/resources/assets/scripts/app/app.coffee index b2d635d5..e61abb70 100644 --- a/resources/assets/scripts/app/app.coffee +++ b/resources/assets/scripts/app/app.coffee @@ -43,14 +43,10 @@ require 'script!../base/moment' require '../base/soundmanager2-nodebug' require 'script!../base/tumblr' require '../base/ui-bootstrap-tpls-0.4.0' -require 'script!../base/underscore' -require '../shared/init.coffee' -require '../shared/jquery-extensions' -require '../shared/layout.coffee' require '../shared/pfm-angular-marked' require '../shared/pfm-angular-sanitize' -require 'script!../shared/underscore-extensions' +require '../shared/init.coffee' ponyfm = angular.module 'ponyfm', ['ui.bootstrap', 'ui.state', 'ui.date', 'ui.sortable', 'angularytics', 'ngSanitize', 'hc.marked'] diff --git a/resources/assets/scripts/embed/player.coffee b/resources/assets/scripts/embed/embed.coffee similarity index 90% rename from resources/assets/scripts/embed/player.coffee rename to resources/assets/scripts/embed/embed.coffee index f6f2cebf..96cc74a7 100644 --- a/resources/assets/scripts/embed/player.coffee +++ b/resources/assets/scripts/embed/embed.coffee @@ -14,6 +14,17 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . + +require 'script!../base/jquery-2.0.2' +require '../base/jquery.timeago' +require '../base/soundmanager2-nodebug' +require './favourite.coffee' + +require 'script!../base/underscore' +require '../shared/layout.coffee' +require 'script!../shared/underscore-extensions' + + $('.timeago').timeago() loaderDef = new $.Deferred() diff --git a/resources/assets/scripts/shared/init.coffee b/resources/assets/scripts/shared/init.coffee index 10ab8e1b..97ee5378 100644 --- a/resources/assets/scripts/shared/init.coffee +++ b/resources/assets/scripts/shared/init.coffee @@ -14,6 +14,12 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . + +require 'script!../base/underscore' +require './jquery-extensions' +require './layout.coffee' +require 'script!./underscore-extensions' + def = new $.Deferred() pfm.soundManager = def.promise() diff --git a/resources/views/tracks/embed.blade.php b/resources/views/tracks/embed.blade.php index 6288e69f..64d90326 100644 --- a/resources/views/tracks/embed.blade.php +++ b/resources/views/tracks/embed.blade.php @@ -62,7 +62,12 @@ @endif - {!! Assets::scriptIncludes('embed') !!} + @if (Config::get("app.debug")) + + + @else + + @endif @if(config('ponyfm.google_analytics_id'))