0

I installed grunt-bower module and followed up the below link:

https://stackoverflow.com/a/22456574/194345

but still not able to access js or css files placed in assets folder.

I installed jquery with bower which is in "assets\lib\jquery\dist\jquery.js" but in browser, tried following URL to access it:

http://localhost:1337/js/jquery.js

http://localhost:1337/lib/js/jquery.js

http://localhost:1337/lib/jquery/dist/jquery.js

it always displays not found.

What is the correct path?

Community
  • 1
  • 1
Brij
  • 6,086
  • 9
  • 41
  • 69

1 Answers1

4

I think you may not have fully implemented the solution from the link you posted, specifically the part about configuring the grunt-bower task. I've edited that otherwise excellent answer to be a but more clear--you need to wrap the configuration in a function and save it as tasks/config/bower.js:

module.exports = function(grunt) {
  grunt.config.set('bower', {
    dev: {
        dest: '.tmp/public',
        js_dest: '.tmp/public/js',
        css_dest: '.tmp/public/styles'
    }
  });

  grunt.loadNpmTasks('grunt-bower');

};

Then, next time you lift Sails, jquery.js will be copied to .tmp/public/js and therefore be available at http://localhost:1337/js/jquery.js.

sgress454
  • 24,870
  • 4
  • 74
  • 92