linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

Environmental Constants #303

Closed StevenHarlow closed 9 years ago

StevenHarlow commented 9 years ago

Is there a built in way to utilize environmental constants with lineman (and specifically linesman-angular-template if not the main app) or will I need to integrate something like grunt-ng-constant (https://github.com/werk85/grunt-ng-constant)? Please take in mind I'm relatively new to the front-end deployment world and it's jungle of tools like Grunt.

davemo commented 9 years ago

Hi @StevenHarlow, there's nothing built-in to Lineman to take advantage of referencing environment variables. You have a few options:

  1. if it's something you need access to in a template you could simply pop it into package.json and access it in your template file as <%= pkg.myThing %>; grunt reads the package.json file and Lineman makes it available to the context of any templates in app/pages.
  2. you could use the plugin you mentioned, install it as a dependency npm i grunt-ng-constant --save-dev and then modify when it runs to suit your needs with the lineman-angular-template; here's an example from our docs: https://github.com/linemanjs/lineman-dogescript/blob/master/config/plugins/dogescript.coffee#L13-L14