generator-angular-fullstack icon indicating copy to clipboard operation
generator-angular-fullstack copied to clipboard

directories with periods in names

Open harvellm opened this issue 12 years ago • 3 comments

Hi,

I'm pretty new to grunt...so this might be easy, but I'll show you what I'm doing and maybe you can help.

Whenever I add a library via bower that has a period in the directory name, slick.js, lunr.js, animate.css, etc. I get a build error as the various build steps are attempting to operate on the directory instead of the file. So, I have gone into the gruntfile and added exclusions for these directories:

rev: { dist: { files: { src: [ '<%= yeoman.dist %>/public/{,}/.js', '<%= yeoman.dist %>/public/{,}/lunr.js/.js', '!<%= yeoman.dist %>/public/bower_components/lunr.js', '<%= yeoman.dist %>/public/{,}/slick.js/.js', '<%= yeoman.dist %>/public/{,}/slick.js/__/.js', '!<%= yeoman.dist %>/public/bower_components/slick.js', '<%= yeoman.dist %>/public/{,/}.css', '<%= yeoman.dist %>/public/assets/images/{,/}.{png,jpg,jpeg,gif,webp,svg}', '<%= yeoman.dist %>/public/assets/fonts/*' ] } } },

and,

usemin: {
  html: ['<%= yeoman.dist %>/public/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/public/{,*/}*.css'],
  js: [
        '<%= yeoman.dist %>/public/{,*/}*.js',
        '<%= yeoman.dist %>/public/{,*}*/lunr.js/*.js',
        '!<%= yeoman.dist %>/public/bower_components/lunr.js',
        '<%= yeoman.dist %>/public/{,*}*/slick.js/*.js',
        '<%= yeoman.dist %>/public/{,*}*/slick.js/**/*.js',
        '!<%= yeoman.dist %>/public/bower_components/slick.js'
        ],
  options: {
    assetsDirs: [
      '<%= yeoman.dist %>/public',
      '<%= yeoman.dist %>/public/assets/images',
      '<%= yeoman.dist %>/public/assets/fonts',
      '<%= yeoman.dist %>/public/assets/artifacts'
    ],
    // This is so we update image references in our ng-templates
    patterns: {
      js: [
        [/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the JS to reference our revved images']
      ]
    }
  }
},

This works, but I need to do it for every project and make it very specific to the project I'm including as you can see. Maybe I'm misunderstanding the globbing rules as I thought I could do it more generically but I have tried several things and none of them works...is there a way for me to make this more generic?

Also, at the same time I discovered this issue, I discovered that certain of these libraries, even after grunt will build them, fail to work after minified and concatenated. Select2, for instance, even once it was added to the exclusion list just as above does not work. Slick is another one. I just get an error about slick not being an object or the like. Is this related to what I'm talking about here or is it a problem with their libraries? If so, they provide a minified version - how do I use the minified version - the injector keeps overwriting my changes in the index.html file and I can't seem to get it to "stick."

I don't think this is a bug in your code but I've looked around and don't see any content on this subject so I think others must not be using libraries with periods in the name or I'm doing something really wrong.

thanks.

harvellm avatar Sep 23 '14 19:09 harvellm

I think this is a duplicate of ~~#420 and~~ #522.

JaKXz avatar Sep 25 '14 04:09 JaKXz

no its not same as #420

programming-kid avatar Dec 22 '14 09:12 programming-kid

bower install animate-css --save

will grab animate.css but save at:

bower_components/animate-css

Problem solved

jamesr-rdm avatar Jul 21 '15 13:07 jamesr-rdm