JavaScript How to manage bower dependencies when developing and deploying with grunt and a dist project folder?

I am trying to set up a Grunt project with bower dependencies with two tasks: development and deploy. The project folder structure currently looks like this:

.
├── bower_components
│   ├── animate.css
│   ├── jquery
│   ├── semantic-ui
│   └── wow
├── dist
│   └── assets
│       ├── styles
│       └── js
├── node_modules
└── src
    └── assets
        ├── less
        └── js

I am currently using grunt-wiredep to automagically include the bower dependencies in the HTML files in dist. I am trying to keep the bower_components out of the dist folder to keep a separation of development and deploy (even though during development the site is served from dist).

As I am new to this I am having a complete imagination failure in working out the right grunt/bower modules and best practice for developing and deploying (yes Yeoman takes care of a lot of this, but I am trying to learn). My current vision is:

  1. Connect serves the HTML pages from the dist folder.
  2. In development bower components would be automatically included in the page (wiredep) but need to be served from within the dist folder (grunt-wiredep-copy).
  3. In deploy the bower components will grab the minified versions and concatenate them with either the project JS and CSS files, or just the bower components in a single JS and CSS file.

My question is: what is the (or a) good way to use bower components in development and deploy targets with minimal grunt-contrib-copy/grunt-contrib-concat/grunt-string-replace or such modules to move files around and rewrite HTML references? Or will this step always have a high manual element to it - which seems odd to me given bower and grunt go together like KFC chips and 'potato and gravy'.

JS and LESS/CSS concatenation is easy with each types respective uglify and minify grunt modules. Bower files are excluded from these processes and wiredep and wiredepCopy don't appear to provide a simple way to "clean up" (minify/concatenate and update the respective links in HTML files) for the deploy task. wiredepCopy doesn't even update references in the HTML during the development task to the moved files which seems odd to me (and begging for a Pull Request). Maybe wiredep is not the way forward? Thanks!

Answer:1

looking at this event (being bind on 2 divs overlapping each other, look at the jsfiddle) .on('contextmenu', function() { ... }); Why do both divs being triggered? How can I detect this and or stop ...

looking at this event (being bind on 2 divs overlapping each other, look at the jsfiddle) .on('contextmenu', function() { ... }); Why do both divs being triggered? How can I detect this and or stop ...

  1. jquery event contextmenu
  2. jquery contextmenu event not working
  3. jquery context menu event
  4. jquery bind event contextmenu
  5. jquery event type contextmenu
  6. jquery event listener context menu
  7. jquery add contextmenu event
  8. jquery contextmenu event example
  9. jquery fire contextmenu event
  10. jquery add event listener context menu

I want to use the onreadystatechange event from the (underlying) XMLHttpRequest of JQuery's (2.0.2) $.ajax(...) to fire synchronous ajax requests so I can show an accurate status indication to the end ...

I want to use the onreadystatechange event from the (underlying) XMLHttpRequest of JQuery's (2.0.2) $.ajax(...) to fire synchronous ajax requests so I can show an accurate status indication to the end ...

  1. onreadystatechange event in ajax
  2. onreadystatechange event in javascript
  3. onreadystatechange event in js

Following issue: Let's say, we have an object like this: $scope.Something = { 'a' : { object... }, 'b' : { another object... } } This Something-object is also rendered in the view as follows: <...

Following issue: Let's say, we have an object like this: $scope.Something = { 'a' : { object... }, 'b' : { another object... } } This Something-object is also rendered in the view as follows: <...

I need to capitalize the first letter of various html elements such as p, h2, h3, h4. This stack question has helped me, however, it only targets the p tag. How can I say to target more than one tag? ...

I need to capitalize the first letter of various html elements such as p, h2, h3, h4. This stack question has helped me, however, it only targets the p tag. How can I say to target more than one tag? ...

  1. capitalize first letter javascript
  2. capitalize first letter python
  3. capitalize first letter excel
  4. capitalize first letter of each word
  5. capitalize first letter java
  6. capitalize first letter css
  7. capitalize first letter c#
  8. capitalize first letter r
  9. capitalize first letter of each word javascript
  10. capitalize first letter google sheets
  11. capitalize first letter php
  12. capitalize first letter after colon
  13. capitalize first letter of each word python
  14. capitalize first letter ruby
  15. capitalize first letter sql
  16. capitalize first letter in quote
  17. capitalize first letter of each word java
  18. capitalize first letter word
  19. capitalize first letter of word javascript
  20. capitalize first letter javascript es6