1

We currently have an older-er .NET MVC 5 app running in production using server side to render the views and client side DurandalJs. We are using weyland.js to minify the APP/viewmodels directory (and others) that Require.JS will "inject". I am using the System.Bunding (Optimization) namespace in .NET for the 3rd party JS and CSS.

I would like to re-do the packaging. Lets say I remove Weyland for Durandal (And require) and the built in system stuff, what can I use in their palace?

I have played with https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier product before and like it, but not sure how to get that to play nice with Require and its AMD syntax.

Any other ideas would be welcome. Seems harder to bundle and deploy an app these days they to create one. :-(

thanks

Update: I guess I should explain a bit more. So, I started to work more with ES6 script. Seems as if weyland was using uglify to handle minification, and that does not play nicely with ES6 (also, Rob E. has stated years ago Weyland was going bye bye). The best I have come up with so far is using GULP to join all my files together and perform whatever magic requireJS needs. Then using the above plugin to handle the minification parts. 2 Major drawbacks

1 - gulp seems to need to be installed locally. this added a ton of files to my web project that I do not need. 2 - Something about this setup does not seem right? too many moving parts for my taste? I don't know enough about minifying requirejs and durandal to know the best/easiest and least intrusive course of action.

JCircio
  • 525
  • 2
  • 7
  • 18

1 Answers1

0

I was in the same situation as you and was able to migrate recently to gulp following this: http://durandaljs.com/documentation/Gulp.html - gulp handles the minification.

My gulpfile.js looks like this

var gulp = require('gulp');
var durandal = require('gulp-durandal');

gulp.task('default', function () {
    durandal({
        baseDir: 'app',
        main: 'main.js',        
        output: 'main-built.js',
        sourceMap: false,
        almond: true,
        minify: true,
        require: true,
        rjsConfigAdapter: function (rjsConfig) {
            rjsConfig.deps = ['text'];
            return rjsConfig;
        }
    }).pipe(gulp.dest('app'))
});
Leo
  • 7,379
  • 6
  • 28
  • 44