mardi 25 août 2015

Laravel Elixir Gulp Requesting CDN and Local Files

I may be overthinking this, but this is what I have so far:

elixir(function(mix) {
    //mix.getCND();
    mix.copy([
        'jquery-1.11.0.min.js'
    ], 'resources/assets/js/cdn.js', '../../venturepro/cdn/js');

    mix.scripts([
        'resources/assets/js/cdn.js',
        'resources/assets/js/core.js'
    ], 'public/assets/js/core.js');
});

I also tried to use gulp-cdnizer as well by doing this, but with no luck:

var gulp = require('gulp');
var cdnizer = require('gulp-cdnizer');
var Elixir = require('laravel-elixir');
var Task = Elixir.Task;

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

Elixir.extend('getCDN', function() {

    new Task('cdnizer', function () {
       return gulp.src('')
           .pipe(cdnizer([
               {
                   package: 'jquery',
                   file: 'resources/assets/js/vendor/jquery.js',
                   cdn: 'http://ift.tt/1WQdxHV'
               }
           ]))
           .pipe(gulp.dest("public/assets/js/"));
    });

});

Elixir(function(mix) {
    mix.getCDN();

    // Combine all files into one single JS file
    mix.scripts([
        'resources/assets/js/vendor/jquery.js',
        'resources/assets/js/core.js'
    ], 'public/assets/js/core.js');
});

It says it compiles, but the cdnizer doesn't seem to be working. I have no new files in my resources directory. However I do get the core.js file in my public directory.

Basically, we have about 5 different projects that are all using/sharing files.. we have a lot of common javascript files that get copied and pasted into different projects so we want to host them in a CDN sort of way. So we have a domain like cdn.website.com.. and we want to be able to pull files from that via Elixir into our project, but still combine project-specific files that are local to the root directory.

I've used Elixir before, but only for local files. Is there a way to grab files via a different domain or as I was trying, go out of the root directory in the CDN directory since they are on the same server?

Thanks.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1WQdxHX
via IFTTT

Aucun commentaire:

Enregistrer un commentaire