JavaScript enhancement
avatar b2z
b2z
8 Nov 2013

After updating my local repos to the latest changes JS on my demo server stopped to work. I checked the paths and seems like JS is loading normally. I thought it could be something with the sync and run local VM server. But unfortunately there is the same problem - JS is loading normally but not working. I tried to dig but nothing found... :(

avatar b2z b2z - open - 8 Nov 2013
avatar b2z b2z - open - 8 Nov 2013
avatar elkuku
elkuku - comment - 9 Nov 2013

Which part is not working ?
I notice that in the issues list view, the popover is not working, due to missing bootstrap.js files...

Stuff like the dropdowns from the main menu seem to work.

avatar b2z
b2z - comment - 9 Nov 2013

Well today it is ok :blush: I do not know what happened, is it a browser cache or something else... But yesterday filters and sorting were not working and an error like TypeError: $ is undefined was thrown.

Ok talking about bootstrap.js - with the Bower it seems like Bootstrap is loaded as separate libraries and I fixed the popover adding

vendor/bootstrap/js/bootstrap-tooltip.js
vendor/bootstrap/js/bootstrap-popover.js

The question is - do we want to require separate files all the time (more http requests) or it is better to have one combined bootstrap.js? If we want separate we could use such toold like Minify to combine all our JS files.

avatar elkuku
elkuku - comment - 9 Nov 2013

I remember that I saw the same thing on your server yesterday before you opened the issue, so I think it was not your browser (or maybe it was mine too :tongue: )

As for Bootstap: IDK :smile:
Maybe it's not meant to be included this way but minified or processed otherwise before adding it to the live site ?
I was just happy to remove the whole external stuff from our main code base...
Experts please :wink:

avatar drmmr763
drmmr763 - comment - 8 Dec 2013

Hey Guys:

I'm running into issues with Bootstrap too myself. I just ran a clean install of the issue tracker app, and after installing I'm seeing calls to bootstrap / other JS:

GET http://jissues.local/vendor/jquery/jquery.min.js 404 (Not Found) jissues.local/:383
GET http://jissues.local/vendor/bootstrap/js/bootstrap-affix.js 404 (Not Found) jissues.local/:384
GET http://jissues.local/vendor/bootstrap/js/bootstrap-tab.js 404 (Not Found) jissues.local/:386
GET http://jissues.local/vendor/bootstrap/js/bootstrap-dropdown.js 404 (Not Found) jissues.local/:385
GET http://jissues.local/vendor/bootstrap/js/bootstrap-popover.js 404 (Not Found) jissues.local/:395
GET http://jissues.local/vendor/bootstrap/js/bootstrap-tooltip.js 404 (Not Found) 

That said, when I check the vendor directory 'bootstrap' isn't even there. I didn't see it in composer or anywhere else either to include it. Any ideas?

avatar mbabker
mbabker - comment - 8 Dec 2013

Did you pull in all the media using Bower? (Is that in the docs at all by chance?)

avatar elkuku
elkuku - comment - 8 Dec 2013

Do we have anything about Bower in our Documentation ? :wink:... (@todo scrape #170)

avatar b2z
b2z - comment - 8 Dec 2013

I think we should go with the Grunt to manage our JS and CSS. It's very useful for minimizing and concatenation. We could have all the vendor files for example in the build dir and in our www we could have minimized and concatenated versions under JS and CSS dirs.

avatar elkuku
elkuku - comment - 9 Dec 2013

I think we should go with Grunt for minifying and "packing" stuff. We are already using bower, so it makes sense to use Grunt instead of Ant, Phing or something. TBH I know very little about Grunt, but it looks promising :wink:
I'm not sure about the vendor files in the build dir. Don't we want the uncompressed versions available for development? How would that work?

avatar b2z
b2z - comment - 9 Dec 2013

That's a good question :) Sure we should left them for the debug purposes. We could copy only the necessary files form the build dir. That's will be an automated Grunt task ;)

For example we could have the following www dir:

\js
  \debug (copy here needed uncompressed files)
   tracker.js
   jquery.js
   bootstrap-tooltip.js
  \vendor (created compressed and concat vendor files)
   jquery.min.js
   bootstrap.min.js
   blueimp.min.js
tracker.concat.min.js (our compressed and concat staff)

\css
  \debug
   vendor files css files
  \vendor
   vendor1.concat.min.css
   vendor2.concat.min.css
tracker.concat.min.css

Or

\js
  \debug (copy here needed uncompressed files)
   tracker.js
   vendor1.js
   vendor2.js
vendor.concat.min.js (vendor compressed and concat staff)
tracker.concat.min.js (our compressed and concat staff)

\css
  \debug
   tracker.css
   vendor1.css
   vendor2.css
vendor.concat.min.css
tracker.concat.min.css

Actually we could play around with that.

avatar elkuku
elkuku - comment - 9 Dec 2013

I'm not sure which I like more - both look good ;)

Just a small naming thingy that came to my mind:
We should rename tracker to custom. So that would make

  • Instead of tracker/core/
  • We'd have custom/tracker

Or in your example:

vendor.concat.min.css
custom.concat.min.css

I think that would make things clearer, but it's just naming.

I'd be in favor to bring in Grunt, set up "something" and see how it works.

avatar b2z
b2z - comment - 9 Dec 2013

I'd be in favor to bring in Grunt, set up "something" and see how it works.

Let me do it :)

avatar elkuku
elkuku - comment - 9 Dec 2013

Go for it :wink:

avatar b2z
b2z - comment - 9 Dec 2013

Here we go :) To play with it checkout grunt branch then issue two commands:

npm install grunt-cli -g
npm install

These will install grunt cli app and grunt modules specified in the package.json file. After that type:
bower install
This will download vendor files to the build/www/vendor directory.

And finally type grunt and the magic will happen - you should have concat and concat.min files under www/css and www/js ;) Examine Gruntfile.js and you will understand how easy it works. Here you will find nice tutorial about Grunt.

vagrant up and test it :) Please note that I did not include all vendor css files and did not modified all template files. It's just main page working using concatenated and minified versions.

avatar elkuku
elkuku - comment - 10 Dec 2013

Everything works as expected. Very nice :+1:

Still not sure how we would handle this during development, but we'll see... Maybe create a "debug.media" config setting and load the custom files that are subject to modifications one by one ?

avatar b2z
b2z - comment - 10 Dec 2013

Still not sure how we would handle this during development, but we'll see...

Why we can't just use a concat version?'

load the custom files that are subject to modifications one by one ?

Do not completely understand what do you mean.

avatar b2z
b2z - assign - 23 Jan 2014
Assigned to b2z
avatar b2z
b2z - comment - 23 Jan 2014

Let's up it :)

Still not sure how we would handle this during development, but we'll see...

I see now what you are talking about. May be during development we can add the code to the custom.concat.js and then just copy it to the build directory?

And one more problem I see here is a CSS vendor files - they all have a relative paths to images and if we will have one custom.concat.min.css how do we manage these paths?

avatar b2z
b2z - comment - 5 Feb 2014

Thinking more about it I came to conclusion that we will have more difficulties to maintain it under two files. May be we should leave it and make concat/min files only within vendors? For example, use Grunt to concatenate all BS files into the one or all Upload files into the one.

avatar elkuku
elkuku - comment - 7 Aug 2015

Not an issue ?

avatar elkuku elkuku - change - 7 Aug 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-08-07 00:47:40
Closed_By elkuku
Build master
avatar elkuku elkuku - close - 7 Aug 2015

Add a Comment

Login with GitHub to post a comment