linemanjs / lineman-angular-template

A Lineman Application Template using AngularJS
251 stars 88 forks source link

Include twitter-boostrap and jquery #5

Closed sarath2 closed 11 years ago

sarath2 commented 11 years ago

I have added boostrap libs to the vendor/js and css. Then trying to apply boostrap dropdown. It not working. Other boostrap's buttons,labels,.. are working well. Also can't add angular-cookies lib.Got errors.

davemo commented 11 years ago

You'll need to provide a link to your code @sarath2, this is impossible to debug from reading your description :)

sarath2 commented 11 years ago

I have added boostrap to the fork. https://github.com/sarath2/lineman-angular-template

davemo commented 11 years ago

So, you'll need to add jquery.js in vendor/js, and configure Lineman to load it first as bootstrap depends on jQuery

In config/files.js :

module.exports = require(process.env['LINEMAN_MAIN']).config.extend('files', {
  ngtemplates: {
    dest: "generated/angular/template-cache.js"
  },

  js: {
    vendor: [
      "vendor/js/jquery.js",
      "vendor/js/angular.js",
      "vendor/js/**/*.js"
    ],
    app: [
      "app/js/app.js",
      "app/js/**/*.js"
    ]
  },

  less: {
    compile: {
      options: {
        paths: ["vendor/css/normalize.css", "vendor/css/**/*.css", "app/css/**/*.less"]
      }
    }
  }
});
sarath2 commented 11 years ago

Thanks Dave. Now it solved.

sarath2 commented 11 years ago

I have two boostrap thems(bootstrap-a.css and bootstrap-b.css). I need to dynamically change it when button click. How can achieve this? Because all css files compile to the one css. In previously I used following way. <link id="bs-css" ng-href="themes/bootstrap-{{ui_theme}}.css" rel="stylesheet"> When button click I change $scope.ui_theme to "a" and "b" .

davemo commented 11 years ago

Supporting dynamic theme switching isn't a use-case we've had to use Lineman for yet, but luckily you can configure the inputs pretty easily in config/files.js and the outputs in config/application.js

If you take a look at the lineman default tasks (which this template inherits from) it should give you a better idea of how you could override the configurations for less compilation to achieve multiple output .css files:

https://github.com/testdouble/lineman/blob/master/config/application.coffee#L26

https://github.com/testdouble/lineman/blob/master/config/files.coffee#L29

sarath2 commented 11 years ago

I'll follow-up it and try to config in my app. Thanks again for your support.

davemo commented 11 years ago

No problem, let me know if you can't figure it out; documenting how Lineman works in inheriting task configurations from the GLOBAL to LOCAL is the next issue on our plate, as it is often confusing :P

sarath2 commented 11 years ago

Is it possible to add folder like "themes" to app directory?. And it contain *.css files. After built each .css comes to separated minify files with themes folder in "generated" and "dist" directory.

Foxandxss commented 11 years ago

That is something you can do yourself with ease. I mean, Limenan provides some defaults, and we the users need to extend it as needed. So create a themes folder, update or override the grunt configs as needed and put one tag per theme if you want.

davemo commented 11 years ago

:+1: @Foxandxss

@sarath2, Grunt is absolutely capable of supporting whatever workflow you want to craft; the goal of Lineman is purely to provide a set of defaults that you can override. These defaults are the result of our workflow building rich-client apps, but we've made them available and packaged them into Lineman in the hopes they are useful for someone else :)