How to get Bower Install to copy files to another directory before linking them in html file?

Stradosphere

In my gruntfile.js I am using bower install to create the necessary script tags in my index.html for all my js libraries. My grunt file entry looks like this:

   bowerInstall: {
      target: {
        src: ['wwwroot/index.html'],
        cwd: '',
        dependencies: true,
        devDependencies: true,
        exclude: [],
        fileTypes: {},
        ignorePath: '',
        overrides: {}
      }
    }

My index.html gets correctly updated from my index.html.tpl as seen here:

<head>
<!-- bower:js -->
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="../bower_components/angular/angular.js"></script>
<script src="../bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="../bower_components/underscore/underscore.js"></script>
<!-- endbower -->
<!-- bower:css -->
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css" />
<!-- endbower -->
<link rel="stylesheet" type="text/css" href="wwwroot/app/styles/style.css" />

What I want to happen is to copy all js library files to a specific lib directory, and then link them from there. Can this be accomplished with bower install or is there another grunt plug-in I should be using? The bower-install plugin seems popular but I can't find much documentation for it.

jmartins

You should try to use grunt-bower along with grunt-bower-install. You can configure bower to install copy files to specific folders. It will look like this:

bower: {
  dev: {
    dest: 'lib/',
    js_dest: 'lib/js',
    css_dest: 'lib/styles'
  }
}

Then if you run the task:

grunt bower

You will have something like this in your lib folder:

  /js
    /package1
      package1_file1.js
      package1_file2.js
    /package2
      package2.js
  /styles
    /package1
      package1.css
    /package2
      package2.css

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Find document files and copy them to another directory

From Dev

Search a directory recursively for files listed in a csv, and copy them to another location

From Dev

How to find files recursively by file type and copy them to a directory while in ssh?

From Dev

Copy files in a directory to another directory

From Dev

Copy files in a directory to another directory

From Dev

'find' all .log files under a directory, copy them to another directory named after their parent directory?

From Dev

How to use grunt-bower-install to update multiple html files

From Dev

How to copy a file to another directory programmatically?

From Dev

How to copy a file to another directory programmatically?

From Dev

How do i copy files from one directory to another directory?

From Dev

How to copy matching files from directory/subdirectory to a another directory

From Dev

How to copy files from one directory to another after closing the Dolphin file manager in Kubuntu 16.04 LTS?

From Dev

How can I get the total size of .conf extension in directory /etc and save them into another file?

From Dev

Copy files listed in a txt file and put it in another directory

From Dev

Copy files listed in a txt file and put it in another directory

From Dev

How many files in a directory before the size of the directory file increase

From Dev

How to get the list of files that are not in another directory in perl

From Dev

How do I copy a file to a different directory, but with another file extension?

From Dev

How to copy all of the files from one directory to another in a bash script

From Dev

how to copy some specific .jpg files to another directory?

From Dev

How to copy only files in a specified directory to another folder

From Dev

How to copy files inside several folders into another directory

From Dev

How to copy files with a particular extension from one directory to another in linux

From Dev

find a file and copy it to another directory

From Dev

Command to copy a file to another directory

From Dev

Command to copy a file to another directory?

From Dev

How to get the list of files in a directory and display them in the table

From Dev

How to copy multiple files with a same name from children directory to another directory without losing the parent directory?

From Dev

How do I copy the latest file from one directory to another?

Related Related

  1. 1

    Find document files and copy them to another directory

  2. 2

    Search a directory recursively for files listed in a csv, and copy them to another location

  3. 3

    How to find files recursively by file type and copy them to a directory while in ssh?

  4. 4

    Copy files in a directory to another directory

  5. 5

    Copy files in a directory to another directory

  6. 6

    'find' all .log files under a directory, copy them to another directory named after their parent directory?

  7. 7

    How to use grunt-bower-install to update multiple html files

  8. 8

    How to copy a file to another directory programmatically?

  9. 9

    How to copy a file to another directory programmatically?

  10. 10

    How do i copy files from one directory to another directory?

  11. 11

    How to copy matching files from directory/subdirectory to a another directory

  12. 12

    How to copy files from one directory to another after closing the Dolphin file manager in Kubuntu 16.04 LTS?

  13. 13

    How can I get the total size of .conf extension in directory /etc and save them into another file?

  14. 14

    Copy files listed in a txt file and put it in another directory

  15. 15

    Copy files listed in a txt file and put it in another directory

  16. 16

    How many files in a directory before the size of the directory file increase

  17. 17

    How to get the list of files that are not in another directory in perl

  18. 18

    How do I copy a file to a different directory, but with another file extension?

  19. 19

    How to copy all of the files from one directory to another in a bash script

  20. 20

    how to copy some specific .jpg files to another directory?

  21. 21

    How to copy only files in a specified directory to another folder

  22. 22

    How to copy files inside several folders into another directory

  23. 23

    How to copy files with a particular extension from one directory to another in linux

  24. 24

    find a file and copy it to another directory

  25. 25

    Command to copy a file to another directory

  26. 26

    Command to copy a file to another directory?

  27. 27

    How to get the list of files in a directory and display them in the table

  28. 28

    How to copy multiple files with a same name from children directory to another directory without losing the parent directory?

  29. 29

    How do I copy the latest file from one directory to another?

HotTag

Archive