Giter Site home page Giter Site logo

Comments (10)

juristr avatar juristr commented on July 20, 2024

If you want, I'm working on a "functioning" version with ngAnnotate. Once I have it properly running, I could send it to you for verification s.t. you can then update the yeoman scaffolding. (unfortunately I didn't yet write any Yeoman generator and don't currently have the time to get into it - although I'd like)

from generator-angular-require.

aaronallport avatar aaronallport commented on July 20, 2024

That would be amazing! Why not fork the code and do this as a pull request?

from generator-angular-require.

aaronallport avatar aaronallport commented on July 20, 2024

Fixed in https://github.com/aaronallport/generator-angular-require/releases/tag/v0.2.6 - This has been published to NPM, but will look to replace ngmin with ngAnnotate soon

from generator-angular-require.

aaronallport avatar aaronallport commented on July 20, 2024

I've sorted this in release v0.2.7 (https://github.com/aaronallport/generator-angular-require/releases/tag/v0.2.7) - ngAnnotate output is written to .tmp, and r.js pick up the files from there for optimising and writes them to the usal place under/dist/scripts

from generator-angular-require.

juristr avatar juristr commented on July 20, 2024

👍 Awesome. Will check out your modifications and test them. Thx!

from generator-angular-require.

aaronallport avatar aaronallport commented on July 20, 2024

You're very welcome. As an aside, I'd love to hear about what you're using this generator for. Keen to see the cool stuff people do with it!

from generator-angular-require.

juristr avatar juristr commented on July 20, 2024

Seems like this fix has some problems.

While ngAnnotate is executed correctly resulting in having all of the ngAnnotate-processed JS files in the .tmp/scripts folder, the requirejs task is executed on the actual source instead of the ngAnnotated one.

I had to change the requirejs task from

// r.js compile config
    requirejs: {
      dist: {
        options: {
          dir: '<%= yeoman.dist %>/scripts/',
          modules: [{
            name: 'main'
          }],
          preserveLicenseComments: false, // remove all comments
          removeCombined: true,
          baseUrl: '<%= yeoman.app %>/scripts',
          mainConfigFile: '.tmp/<%= yeoman.app %>/scripts/main.js',
          optimize: 'uglify2',
          uglify2: {
            mangle: false
          }
        }
      }
    }

to

// r.js compile config
    requirejs: {
      dist: {
        options: {
          dir: '<%= yeoman.dist %>/scripts/',
          modules: [{
            name: 'main'
          }],
          preserveLicenseComments: false, // remove all comments
          removeCombined: true,
          baseUrl: '.tmp/<%= yeoman.app %>/scripts',
          mainConfigFile: '.tmp/<%= yeoman.app %>/scripts/main.js',
          optimize: 'uglify2',
          uglify2: {
            mangle: false
          }
        }
      }
    }

Moreover, to have the r.js minification work properly, I had to introduce a copy task that copied the bower_components to the .tmp folder.

I think you could also switch the mangle: false to true to get an even better compression as with ngAnnotate should fix the DI issue.


The bower_components are not copied correctly to the dist directory. This is probably because the bower root folder has been moved from inside the app/ to the application root. Consequently the line bower_components/**/* doesn't match any folder.

dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'bower_components/**/*',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }

There is a part further down in the copy:dist task but it only copies the sass fonts. Changing it to

{
   expand: true,
   cwd: '.',
   src: 'bower_components/**',
   dest: '<%= yeoman.dist %>'
}

(btw, how do you test your yeoman generator locally?? So I could send a pull-request directly next time)

from generator-angular-require.

aaronallport avatar aaronallport commented on July 20, 2024

I'll take a look at this - thanks for your great response! I'll try and answer your points soon. I'm almost done with the re-factoring using class-extend (much like yeoman/generator-backbone)

sorry for not replying sooner

from generator-angular-require.

aaronallport avatar aaronallport commented on July 20, 2024

Sorry, I'm still trying to get the re-factored tests running on the generator-cleanup branch. Once this is done I'll turn my attention to sorting issues.

As for running locally to test, clone the repo, and from within the generator-angular-require top-level directory, run "npm link" - this should create a link so that when creating and navigating in to a directory such as "generator-ang-req-playground", running "yo angular-require" will use the version from your machine. It might be a good idea to uninstall the generator-angular-require package from your machine first.

Cheers,

Aaron

from generator-angular-require.

aaronallport avatar aaronallport commented on July 20, 2024

Released in 0.3.0

from generator-angular-require.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.