Git Product home page Git Product logo

ngbp's Introduction

An opinionated kickstarter for AngularJS projects.


Quick Start

Install Node.js and then:

$ git clone git://github.com/joshdmiller/ng-boilerplate
$ cd ng-boilerplate
$ sudo npm -g install grunt-cli karma bower
$ npm install
$ bower install
$ grunt watch

Finally, open file:///path/to/ng-boilerplate/build/index.html in your browser.

Happy hacking!

Purpose

ngBoilerplate is designed to make life easy by providing a basic framework with which to kickstart AngularJS projects. It contains a best-practice directory structure to ensure code reusability and maximum scalability. ngBoilerplate also comes prepackaged with the most popular design frameworks around: Twitter Bootstrap, Angular UI, Angular Bootstrap, Font Awesome, and LESS. Lastly, it contains a sophisticated Grunt-based build system to ensure maximum productivity. All you have to do is clone it and start coding!

Philosophy

The principal goal of ngBoilerplate is to set projects up for long-term success. So ngBoilerplate tries to follow best practices everywhere it can. These are:

  • Properly orchestrated modules to encourage drag-and-drop component re-use.
  • Tests exist alongside the component they are testing with no separate test directory required; the build process should be sophisticated enough to handle this.
  • Speaking of which, the build system should work automagically, without involvement from the developer. It should do what needs to be done, while staying out of the way. Components should end up tested, linted, compiled, and minified, ready for use in a production environment.
  • Integration with popular tools like Bower, Karma, and LESS.
  • Encourages test-driven development. It's the only way to code.
  • A directory structure that is cogent, meaningful to new team members, and supporting of the above points.
  • Well-documented, to show new developers why things are set up the way they are.
  • It should be responsive to evidence. Community feedback is therefore crucial to the success of ngBoilerplate.

But ngBoilerplate is not an example of an AngularJS app: this is a kickstarter. If you're looking for an example of what a complete, non-trivial AngularJS app that does something real looks like, complete with a REST backend and authentication and authorization, then take a look at angular-app, which does just that - and does it well.

Learn

Overall Directory Structure

At a high level, the structure looks roughly like this:

ng-boilerplate/
  |- grunt-tasks/
  |- karma/
  |- src/
  |  |- app/
  |  |  |- <app logic>
  |  |- assets/
  |  |  |- <static files>
  |  |- common/
  |  |  |- <reusable code>
  |  |- less/
  |  |  |- main.less
  |- vendor/
  |  |- angular-bootstrap/
  |  |- bootstrap/
  |  |- placeholders/
  |- .bowerrc
  |- bower.json
  |- build.config.js
  |- Gruntfile.js
  |- module.prefix
  |- module.suffix
  |- package.json

What follows is a brief description of each entry, but most directories contain their own README.md file with additional documentation, so browse around to learn more.

  • karma/ - test configuration.
  • src/ - our application sources. Read more »
  • vendor/ - third-party libraries. Bower will install packages here. Anything added to this directory will need to be manually added to build.config.js and karma/karma-unit.js to be picked up by the build system.
  • .bowerrc - the Bower configuration file. This tells Bower to install components into the vendor/ directory.
  • bower.json - this is our project configuration for Bower and it contains the list of Bower dependencies we need.
  • build.config.js - our customizable build settings; see "The Build System" below.
  • Gruntfile.js - our build script; see "The Build System" below.
  • module.prefix and module.suffix - our compiled application script is wrapped in these, which by default are used to place the application inside a self-executing anonymous function to ensure no clashes with other libraries.
  • package.json - metadata about the app, used by NPM and our build script. Our NPM dependencies are listed here.

Detailed Installation

This section provides a little more detailed understanding of what goes into getting ngBoilerplate up and running. Though ngBoilerplate is really simple to use, it might help to have an understanding of the tools involved here, like Node.js and Grunt and Bower. If you're completely new to highly organized, modern JavaScript development, take a few short minutes to read this overview of the tools before continuing with this section.

Okay, ready to go? Here it is:

ngBoilerplate uses Grunt as its build system, so Node.js is required. Also, Grunt by default no longer comes with a command-line utility and Karma and Bower must end up in your global path for the build system to find it, so they must be installed independently. Once you have Node.js installed, you can simply use npm to make it all happen:

$ npm -g install grunt-cli karma bower

If you're on Linux (like I am) then throw sudo in front of that command. If you're on Windows, then you're on your own.

Next, you can either clone this repository using Git, download it as a zip file from GitHub, or merge the branch into your existing repository. Assuming you're starting from scratch, simply clone this repository using git:

$ git clone git://github.com/joshdmiller/ng-boilerplate my-project-name
$ cd my-project-name

And then install the remaining build dependencies locally:

$ npm install

This will read the dependencies (empty by default) and the devDependencies (which contains our build requirements) from package.json and install everything needed into a folder called node_modules/.

There are many Bower packages used by ngBoilerplate, like Twitter Bootstrap and Angular UI, which are listed in bower.js. To install them into the vendor/ directory, simply run:

$ bower install

In the future, should you want to add a new Bower package to your app, run the install command:

$ bower install packagename --save-dev

The --save-dev flag tells Bower to add the package at its current version to our project's bower.js file so should another developer download our application (or we download it from a different computer), we can simply run the bower install command as above and all our dependencies will be installed for us. Neat!

Technically, ngBoilerplate is now ready to go.

However, prior to hacking on your application, you will want to modify the package.json file to contain your project's information. Do not remove any items from the devDependencies array as all are needed for the build process to work.

To ensure your setup works, launch grunt:

$ grunt watch

The built files are placed in the build/ directory by default. Open the build/index.html file in your browser and check it out! Because everything is compiled, no XHR requests are needed to retrieve templates, so until this needs to communicate with your backend there is no need to run it from a web server.

watch is actually an alias of the grunt-contrib-watch that will first run a partial build before watching for file changes. With this setup, any file that changes will trigger only those build tasks necessary to bring the app up to date. For example, when a template file changes, the templates are recompiled and concatenated, but when a test/spec file changes, only the tests are run. This allows the watch command to complete in a fraction of the time it would ordinarily take.

In addition, if you're running a Live Reload plugin in your browser (see below), you won't even have to refresh to see the changes! When the watch task detects a file change, it will reload the page for you. Sweet.

When you're ready to push your app into production, just run the compile command:

$ grunt compile

This will concatenate and minify your sources and place them by default into the bin/ directory. There will only be three files: index.html, your-app-name.js, and your-app-name.css. All of the vendor dependencies like Bootstrap styles and AngularJS itself have been added to them for super-easy deploying. If you use any assets (src/assets/) then they will be copied to bin/ as is.

Lastly, a complete build is always available by simply running the default task, which runs build and then compile:

$ grunt

The Build System

The best way to learn about the build system is by familiarizing yourself with Grunt and then reading through the heavily documented build script, Gruntfile.js. But you don't need to do that to be very productive with ngBoilerplate. What follows in this section is a quick introduction to the tasks provided and should be plenty to get you started.

The driver of the process is the delta multi-task, which watches for file changes using grunt-contrib-watch and executes one of nine tasks when a file changes:

  • delta:gruntfile - When Gruntfile.js changes, this task runs the linter (jshint) on that one file and reloads the configuration.
  • delta:assets - When any file within src/assets/ changes, all asset files are copied to build/assets/.
  • delta:html - When src/index.html changes, it is compiled as a Grunt template, so script names, etc., are dynamically replaced with the correct values configured dynamically by Grunt.
  • delta:less - When any *.less file within src/ changes, the src/less/main.less file is linted and copied into build/assets/ng-boilerplate.css.
  • delta:jssrc - When any JavaScript file within src/ that does not end in .spec.js changes, all JavaScript sources are linted, all unit tests are run, and the all source files are re-copied to build/src.
  • delta:coffeesrc - When any *.coffee file in src/ that doesn't match *.spec.coffee changes, the Coffee scripts are compiled independently into build/src in a structure mirroring where they were in src/ so it's easy to locate problems. For example, the file src/common/titleService/titleService.coffee is compiled to build/src/common/titleService/titleService.js.
  • delta:tpls - When any *.tpl.html file within src/ changes, all templates are put into strings in a JavaScript file (technically two, one for src/common/ and another for src/app/) that will add the template to AngularJS's $templateCache so template files are part of the initial JavaScript payload and do not require any future XHR. The template cache files are build/template-app.js and build/template-common.js.
  • delta:jsunit - When any *.spec.js file in src/ changes, the test files are linted and the unit tests are executed.
  • delta:coffeeunit - When any *.spec.coffee file in src/ changes, the test files are linted, compiled their tests executed.

As covered in the previous section, grunt watch will execute a full build up-front and then run any of the aforementioned delta:* tasks as needed to ensure the fastest possible build. So whenever you're working on your project, start with:

$ grunt watch

And everything will be done automatically!

Build vs. Compile

To make the build even faster, tasks are placed into two categories: build and compile. The build tasks (like those we've been discussing) are the minimal tasks required to run your app during development.

Compile tasks, however, get your app ready for production. The compile tasks include concatenation, minification, compression, etc. These tasks take a little bit longer to run and are not at all necessary for development so are not called automatically during build or watch.

To initiate a full compile, you simply run the default task:

$ grunt

This will perform a build and then a compile. The compiled site - ready for uploading to the server! - is located in bin/, taking a cue from traditional software development. To test that your full site works as expected, open the bin/index.html file in your browser. Voila!

Live Reload!

ngBoilerplate also includes Live Reload, so you no longer have to refresh your page after making changes! You need a Live Reload browser plugin for this:

Note that if you're using the Chrome version with file:// URLs (as is the default with ngBoilerplate) you need to tell Live Reload to allow it. Go to Menu -> Tools -> Extensions and check the "Allow access to file URLs" box next to the Live Reload plugin.

When you load your page, click the Live Reload icon in your toolbar and everything should work magically. w00t!

If you'd prefer to not install a browser extension, then you must add the following to the end of the body tag in index.html:

<script src="http://localhost:35729/livereload.js"></script>

Boom!

Roadmap

This is a project that is not broad in scope, so there's not really much of a wish list here. But I would like to see a couple of things:

I'd like it to be a little simpler. I want this to be a universal starting point. If someone is starting a new AngularJS project, she should be able to clone, merge, or download its source and immediately start doing what she needs without renaming a bunch of files and methods or deleting spare parts. What I have works for a first release, but I just think there is a little too much here right now.

I'd also like to see a simple generator. Nothing like Yeoman, as there already is one of those, but just something that allows the user to say "I want Bootstrap but not Font Awesome and my app is called 'coolApp'. Gimme." Perhaps a custom download builder like UI Bootstrap has. Like that. Then again, perhaps some Yeoman generators wouldn't be out of line. I don't know. What do you think?

Naturally, I am open to all manner of ideas and suggestions. See the "Contributing" section below.

To Do

See the issues list. And feel free to submit your own!

Contributing

This is an opinionated kickstarter, but the opinions are fluid and evidence-based. Don't like the way I did something? Think you know of a better way? Have an idea to make this more useful? Let me know! You can contact me through all the usual channels or you can open an issue on the GitHub page. If you're feeling ambitious, you can even submit a pull request - how thoughtful of you!

Make sure to check out the Contributing Guide.

So join the team! We're good people.

ngbp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngbp's Issues

Add SASS/Compass support

First off, let me say that I really like this kickstarter. It is a great stating point. I think it's great that it has the LESS support.

It would be great if it also supported SASS/Compass.

Warnings for several karma packages

I'm getting the following error I think during bower install, it may have been npm install though. Sorry my cmd won't scroll any higher to let me see :P

Running "karma:continuous" (karma) task
WARN [plugin]: Cannot find plugin "karma-jasmine".
  Did you forget to install it ?
  npm install karma-jasmine --save-dev
WARN [plugin]: Cannot find plugin "karma-firefox-launcher".
  Did you forget to install it ?
  npm install karma-firefox-launcher --save-dev
WARN [plugin]: Cannot find plugin "karma-chrome-launcher".
  Did you forget to install it ?
  npm install karma-chrome-launcher --save-dev
WARN [plugin]: Cannot find plugin "karma-coffee-preprocessor".
  Did you forget to install it ?
  npm install karma-coffee-preprocessor --save-dev
Warning: No provider for "framework:jasmine"! (Resolving: framework:jasmine) Use
 --force to continue.

Aborted due to warnings.

I think you are trying to load these in a clever way at the bottom of the Gruntfile.js? Perhaps its because I use Windows 7. Which I know you'll probably scoff at and that's fine. I had to install them manually with:

npm install karma-jasmine karma-firefox-launcher karma-chrome-launcher karma-
coffee-preprocessor --save-dev

Might be good for a FAQ at least or something...

Why aren't some bootstrap styles in final CSS

Hi,

I'm really liking ng-boilerplate. I'm a total newbie to angular and all the technogies you are using, but really like them.

As I'm trying to modify things I took some code from a JSFiddle (http://jsfiddle.net/bgrimes/58wqH/) that helps the user walk through a wizard. It is using some styles from twitter's bootstrap project which it looks like your project uses. The style is "form-horizontal" and I can see it in both bootstrap.css and bootstrap-responsive.css. But when it builds I don't see that particular style in the final dist/assets/ng-boilerplate.css. I can see parts of bootstrap.css in the final version but not the ones I was hoping to use.

Would it be getting minimized out for some reason? I just put the following in the index.html file to test that theory.

This is a test of stuff.

But it still didn't put it in final CSS file. I had code like that in some new pages I was playing with. The new page I've added (and can see it getting loaded) is below.

Any ideas why not all of the bootstrap.css styles are in the final css?

Thanks,
Brent

<div class="row-fluid">
    <h1 class="page-header">
        Genealogy Charts
        <small>Descendency Charts.</small>
    </h1>

    <form class="form-horizontal">

        <ul class="nav nav-tabs">
            <li ng-repeat="step in steps" ng-class="{active: $index==getCurrentStepIndex()}">
                <a href="javascript:void(0)" ng-click="goToStep($index)">{{step}}</a>
            </li>
        </ul>
        <div ng-switch on="selection">

            <!-- First Step -->
            <div ng-switch-when="Step 1: Team Info">
                <h1>Step 1</h1>
            </div>

            <!-- Second Step -->
            <div ng-switch-when="Step 2: Campaign Info">
                <h1>Step 2</h1>
            </div>

            <!-- Third Step -->
            <div ng-switch-when="Step 3: Campaign Media">
                <h1>Step 3</h1>
            </div>
        </div>
        <div class="clearfix"></div>
        <ul class="pager pull-left">
            <li class="" ng-class="{disabled: !hasPreviousStep()}">
                <a href="javascript:void(0);" ng-click="decrementStep()">&larr; Previous Step</a>
            </li>
            <li class="" ng-class="{disabled: !hasNextStep()}">
                <a href="javascript:void(0);" ng-click="incrementStep()">Next Step &rarr;</a>
            </li>
        </ul>
        <div class="pull-right"><button style="margin:20px 0;" class="btn btn-success">Confirm and Register</button></div>
        <div class="clearfix"></div>
    </form>


</div>


grunt watch hangs on karma:unit:run task

Hi,

I have this issue every time I update a js file, for example a Ctrl.
But runnig "grunt delta" and "karma start karma/karma-unit.js", in two different console, it's works well.

This the output after an hangs:

Running "clean:0" (clean) task
Cleaning "dist"...OK

Running "html2js:app" (html2js) task

Running "html2js:component" (html2js) task

Running "jshint:src" (jshint) task
>> 16 files lint free.

Running "jshint:test" (jshint) task
>> 4 files lint free.

Running "jshint:gruntfile" (jshint) task
>> 1 file lint free.

Running "jshint:globals" (jshint) task
>> 0 files lint free.

Running "karma:continuous" (karma) task
INFO [karma]: Karma server started at http://localhost:9018/
INFO [launcher]: Starting browser Firefox
INFO [Firefox 20.0 (Linux)]: Connected on socket id Znh0ouyJ14JFR2s9d17s
......
Firefox 20.0 (Linux): Executed 6 of 6 SUCCESS (0.434 secs / 0.039 secs)

Running "concat:dist" (concat) task
File "dist/assets/clean-power-circle.js" created.

Running "concat:libs" (concat) task
File "dist/assets/libs.js" created.

Running "ngmin:dist" (ngmin) task
ngminifying dist/assets/clean-power-circle.js

Running "uglify:dist" (uglify) task
File "dist/assets/clean-power-circle.min.js" created.

Running "recess:build" (recess) task
File "dist/assets/clean-power-circle.css" created.
Uncompressed size: 150906 bytes.
Compressed size: 17191 bytes gzipped (125053 bytes minified).

Running "index" task

Running "copy:assets" (copy) task
Created 3 directories, copied 8 files

Running "copy:bin" (copy) task
Created 1 directories, copied 1 files

Running "karma:unit" (karma) task

Running "delta" task
Waiting...OK
>> File "src/app/membership/membership.js" changed.
Running "jshint:src" (jshint) task
>> 16 files lint free.

Running "karma:unit:run" (karma) task

How to store the project in my own repo while maintaining the link to yours for updating

I'm not a git wizard by any means so maybe this is a weird question. But I'm having trouble figuring out how I would clone your repo and then save it into my own repo (https://github.com/timkindberg/animation-sink), where the initial commit is the one right after editing package.json and some of the other config files.

How do I do that?
Also then how to I maintain the link to your git repo for making updates in the future?

Build / Vendor confusion

The "Read More ..." next to "build /" lands at the Vendor documentation page, not that for Build. Also, this "Vendor" documentation says that the vendor directory contains Angular version 1.1.2, but in fact the vendor/ directory contains Angular 1.0.7. The build directory however does contain 1.1.2. Is it supposed to be like this, having two different Angular versions included?

Why not base that on HTML5 Boilerplate ?

It's a boilerplate, but not based on the most used boilerplate :)

HTML5 Boilerplate has a lot of great features, Modernizr integration, and several gotches dealt with.

Why wasn't it used as a base ?

Problems with Grunt Populating the Main Index

After following the walk through, I've run into an issue where I'm not seeing grunt complete the addresses in the index correctly. I believe these files should be address via the main.less, which is there... but it's not turning the variable value into a string for render.

Any help?

<link rel="stylesheet" type="text/css" href="assets/<%= grunt.config.get('pkg.name') %>.css"/>

Including Restangular in ng-boilerplate

Hey,

I now I might be biased as I'm creator of Restangular, but I think it could be a nice addition to this Kickstarter AngularJS project. Angular's default $resource needs MUCH MUCH love. That's the love and sugar that I brought with Restangular.

Take a look at https://github.com/mgonto/restangular and let me know what you think and we can talk about including it here if you want :).

Thanks!

Changes to how things are loaded to ease development

So I've built a few projects now starting with the ngBoilerplate structure, and I've ended up doing it a bit different to make it easier during development.

The main difference is that during development, I don't concatenate everything.

I use a foreach loop in the index.html to dynamically load js/css:

  <% distCss.forEach(function(file) { %>
  <link rel="stylesheet" href="<%= file %>"></script>
  <% }); %>
  <% distJs.forEach(function(file) { %>
  <script src="<%= file %>"></script>
  <% }); %>

I have a components list in my Gruntfile to ensure load order is correct:

  //List all our files we'll be using.  We list components in the order
  //that they need to be loaded.
  files: {
    js: ['src/**/*.js', '!src/**/*.spec.js'],
    tpl: ['src/**/*.tpl.html'],
    test: ['src/**/*.spec.js'],
    styl: ['stylus/main.styl'],
    component: [
      'components/appframework/jq.mobi.js',
      'components/angular-unstable/angular.js',
      'components/angular-mobile-nav/mobile-nav.js',
      'components/angular-collection/angular-collection.js',
      'components/promise-tracker/promise-tracker.js',
      'components/Snap.js/snap.js'
    ]
  },

Then I have a simple build step which builds distJs and distCss:

grunt.registerTask('build', 'Build all files to dist, build file list for index.html', function() {
  var jsFiles = grunt.config('files.component');
  jsFiles = jsFiles.concat(grunt.file.expand(grunt.config('files.js')).map(function(file) {
    return file.replace('src/', '');
  }));
  jsFiles.push(grunt.config('html2js.files.dest').replace('dist/',''));

  grunt.config('distJs', jsFiles);
  grunt.config('distCss', getCssFiles());

  grunt.task.run(['jshint', 'clean', 'html2js', 'stylus', 'copy']);
});

Now during development, I simply copy components/ and src/ javascript files into dist/. Then I just load all of the files into index.html. This makes it so errors appear in the correct files and it's really easy to do debugging, breakpoints, etc.

Then I have a build-production step where I just concatenate everything, ngmin it, and uglify it into one css file and one js file.

If you're interested in this, I could setup a pull request. I would also upgrade to grunt-karma.

How to use ng-include files as partials?

I'm trying to use an ng-include to load a partial (for the purpose of simplifying the main index.html file.
/div data-ng-include data-src="'src/login/login.tpl.html'"/ also tried
/div data-ng-include data-src="'src/common/login/login.tpl.html'"/

[Discovered that it does include the file as long as it ends in .tpl.html Tried any number of paths until I realized that 'grunt watch' does not pickup the file and copy it. If I copy the files into the correct folder in the build…the app works.]

It adds the file to the template cache, but how do I 'call' it in the index.html file?

Any idea on how to make this work?

Add Multiple app support

Hey Josh,

I like your boilerplate and I would love to migrate my current project from brunch.io to ng-boilerplate. But in my project I have 2 single page apps, with each having different app_files config and different index.html files as well.

I tried to run grunt watch parallely, but looks like livereload on port 35729 seems to conflict. It would be great if you could add support for multiple single page apps.

And thanx for your great effort.

New files not monitored and processed by grunt watch

I can change any of the default js or tpl.html files, like home/home.js, or home.tpl.html, and my grunt watch immediately picks up the change and performs the necessary build steps.

If I make any changes to any js files I've created after starting "grunt watch" (say 'new.js'), or any tpl.html files I've created, my grunt watch doesn't see the change and takes no action. If I re-launch grunt watch, the newer files get monitored.

Should grunt watch be able to monitor newly created js, css, and tpl.html files without having to re-launch it?

Add CoffeeScript support

Hey Josh,

I like your kickstarter and as I code in CoffeeScript, I created this fork:
https://github.com/mgibowski/ng-boilerplate

Let me know if you'd like me to do a pull request. It adds coffee script support but does not do any harm if you don't have coffee scripts in your project.

The only intrusive thing I did was migrating the app.js and app.spec.js into coffeescript. I can remove these changes before creating a PR.

And thanx for your great effort, this boilerplate is really cool!

Can't seem to keep auto build/load going for more than 10 or so minutes

I'm running 'grunt watch' using mingw on Windows. The page stops reloading (via LiveReload) after the script reaches:
'Running "uglify:dist" (uglify task)
File " dist/assets/app-name.min.js" created
Done, without errors.'

This has happened multiple times while trying to add a new module to ng-boilerplate.

windows 8 - bower pulls, but doesn't install in vendor directory

from the command line, 'bower install' does not copy all the anguarl/bootstrap packages to the vendor directory. it clones the packages, but the doesn't do anything with them. am I missing something?

Here is my result:
C:\Users\matt\My Documents\github\ng-boilerplate>bower install
bower cloning git://github.com/angular-ui/bootstrap-bower.git
bower cached git://github.com/angular-ui/bootstrap-bower.git
bower fetching angular-bootstrap
bower cloning git://github.com/twitter/bootstrap.git
bower cached git://github.com/twitter/bootstrap.git
bower fetching bootstrap
bower cloning git://github.com/angular-ui/ui-utils.git
bower cached git://github.com/angular-ui/ui-utils.git
bower fetching angular-ui-utils

but the /vendor folder only contains the placeholder boilerplate predefined folder. any ideas? the bower configuration files look right (they are what come out of the git repository).

  • thanks

CSS files should be included in the build

I am using several css files for my site made by myself.
not less file. pure CSS file.
And I know the tool of converting CSS to less.

But I want to use pure CSS files, without converting to less.
How to import them?

After running grunt, I get ... Fatal error: Cannot read property 'red' of undefined

I get the following error when running grunt.
Running "recess:build" (recess) task
Fatal error: Cannot read property 'red' of undefined

Here's the entire log:

grunt
Running "clean:0" (clean) task

Running "html2js:app" (html2js) task

Running "html2js:component" (html2js) task

Running "jshint:src" (jshint) task

16 files lint free.

Running "jshint:test" (jshint) task

4 files lint free.

Running "jshint:gruntfile" (jshint) task

1 file lint free.

Running "jshint:globals" (jshint) task

0 files lint free.

Running "test:unit" (test) task
INFO [testacular]: Testacular server started at http://localhost:9018/
INFO [launcher]: Starting browser Firefox
INFO [Firefox 16.0 (Mac)]: Connected on socket id GQmF8UwyBM1c-bETSCFe
.......
Firefox 16.0 (Mac): Executed 7 of 7 SUCCESS (0.224 secs / 0.052 secs)
Running cmd

Running "concat:dist" (concat) task
File "dist/assets/ng-boilerplate.js" created.

Running "concat:libs" (concat) task
File "dist/assets/libs.js" created.

Running "uglify:dist" (uglify) task
File "dist/assets/ng-boilerplate.min.js" created.
Uncompressed size: 82592 bytes.
Compressed size: 9520 bytes gzipped (48083 bytes minified).

Running "recess:build" (recess) task
Fatal error: Cannot read property 'red' of undefined

Add E2E Tests

Sorry guys, I'm sure that it's not the right place for asking but I need to add some e2e tests and I don't know how is's the best way to do it in ngBoilerplate/Karma.

Thanks for your patience!

Proposal for 0.4.0

I love how ng-boilerplate organizes the code by feature. But one thing that concerns me is the easy upgrade path & configurability without reverting to modifying the Gruntfile.js. Here's my little proposal on that for 0.4.0.

  1. Rename Gruntfile.js to boilerplate.js & build.config.js to Gruntfile.js
    • This would allow users to load tasks from boilerplate.js and customize it by passing additional options like build_files, app_files etc
    • Inaddition, upgrade path will be simple and straight forward as they will have to only update boilerplate.js and retain their own version of Gruntfile.js
    • Alternate approach would be publish boilerplate.js as a separate npm module & import using grunt.loadNpmTasks. IMO that wont be good as it will leave user to create his folder structure again which will defeat the purpose of ng-boilerplate. Also it will make reading from projects package.json more difficult.
  2. Move module.prefix and module.suffix as options inside boilerplate.js, so that all configurable options reside inside boilerplate.js but can be overrided on case to case basis inside users Gruntfile.js
  3. Replace all references of src/app, src/common etc from boilerplate.js with configurable option, so that it can overrided within user's Gruntfile.js
  4. In development mode, changes to css or less files should only update the stylesheet of the page without reloading the whole page.
  5. less files can be bundled along with its own features similar to the specs & importing can be automated. One problem in this will be to come up with the correct order for the less import. This can be done by building a map between angular.module's name and its dependencies. Then the less files can be imported from the sub directories in the same order. This will also then require user to have sub-dir's name to be inline with module name. ie myapp.x.y module should always be placed inside src/myapp/x/y

4 & 5 are more difficult to achieve so I wouldn't vouch adding them in 0.4.0 but may be sometime in the future.

These are just my thoughts and I havent tried it out yet. Before that, I would love to hear community's feedback on this.

real simple question from newbie

Hi,

Can you add to the Getting Started docs on how to add components? For example...

I want to add the angular-ui/ui-ace (https://github.com/angular-ui/ui-ace) plugin.

I add to bower.js

"angular-ui-ace": "latest"

RUN: bower install

I see the files show up in src/app/components

Now what do i do?

Any help would be great!

Add Jade support

Since coffescript is already supported (#48) and there's already a ticket for SASS/Compass support(#31), it would be great if Jade support is added as well.

Directory Structure

I am wondering the reasoning behind having separate directories for build & compile. In brunch, it creates only _public directory which contains derived files based on which command you use because you would rarely use both development and production at the same time.

Also can karma-unit.tpl.js be moved out of karma subdirectory to toplevel?

If you are ok with it, I can probably raise a PR..

Speed Up Development Cycle in Watch

The watch task executes several slow tasks that need not be performed, like annotation, minification, and compression. There should be a distinction between build-related tasks and distribution-related tasks.

Set pageTitle via state object

I had an idea to reduce complexity. Instead of setting page titles in every submodule's controller via titleService, just listen for $stateChangeSuccess in AppCtrl and set the title based on an extra custom pageTitle property on each state.

So in app.js controller:

.controller( 'AppCtrl', function AppCtrl ( $scope, $location, titleService ) {
    $scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){ 
        titleService.setTitle( toState.pageTitle );     
    });
})

Then in every state config object, just set pageTitle as a custom property. Custom properties are a smidge frowned upon, we encourage you to put any custom properties into a data property to "namespace" them. Anyway I think its fine.

So you'd do this in home.js config:

.config(function config( $stateProvider ) {
  $stateProvider.state( 'home', {
    url: '/home',
    views: {
      "main": {
        controller: 'HomeCtrl',
        templateUrl: 'home/home.tpl.html'
      }
    },
    pageTitle: "Home"
  });
})

Now you can remove all titleService calls in submodule controllers. :)

Attempting to use angular-resource but keep geting "Error: No module: ngResource"

Ok. Have bashed my head a bit trying to get this working last night but have been unsuccessful. I want to use ngResource in my app but something isn't working.

I previously had ngResource working with the angular seed app but in the port over to ngBoilerplate, I'm missing something.

NB: I'm fairly new to AngularJS, GruntJS etc so it's highly possible I'm just missing something.

What I've done:

  • Used bower to install it.
  • Included it in Gruntfile.js in the vendors array
    vendor: {
      js: [
        'vendor/angular-bootstrap/ui-bootstrap-tpls.min.js',
        'vendor/placeholders/angular-placeholders-0.0.1-SNAPSHOT.min.js',
        'vendor/angular-ui-utils/modules/route/route.js',
        'vendor/angular-resource/angular-resource.js'
      ]
    },
  • In reality I've added ngResource as a dependency on a service I'm creating but as a test I added it to app.js for simplicity of this issue. Same error occurs in both situations.
angular.module( 'ngBoilerplate', [
  'ngResource',
  'templates-app',
  'templates-component',
  'ngBoilerplate.home',
  'ngBoilerplate.about',
  'ui.route'
])

When I run grunt, the error Error: No module: ngResource occurs.

I'm at a complete loss as I'm sure this is set up in a similar way to how I had it working before. I've confirmed that the angular-resource JS is being included in the final dist but this is still not working.

Anybody have any insights? Let me know if any other additional information would be useful.

Thanks in advance.

This is really cool - routing question

Hi Josh,

So I noticed for each part of the site you're setting up the routes yourself. The about page is an example of this:

https://github.com/joshdmiller/ng-boilerplate/blob/master/src/app/about/about.js

Do you worry about url collisions for more complex applications? And more importantly, do you have a vision for how to handle deep-link navigation, Ie. if I had a root url:

https://mysite.com/help

and wanted to set up separate pages for each help page:

  • https://mysite.com/help/intro
  • https://mysite.com/help/logging-in

etc. I've been unable to find anything conclusive online, but can I only specify a full path to the routeHandler? Like I can't just watch for route changes on everything after my module's root url (similar to how express does it with applications, for example).

Thank ya kindly and keep up the awesome work!
Conor

Karma Tests don't use build output location

The karma-unit.js file has the build output location hard-coded to the dist folder on Line 15.

This causes the following error with grunt watch:

WARN [watcher]: Pattern "/home/me/src/js/dist/tmp/**/*.js" does not match any file.

It would be better if this could come from the build output location variable.

Why aren't Angular & Angular UI sources minified

Hi there - love the framework, at last there's a sensible approach to modular construction.

When I use developer tools to see the download files libs.js is the largest. When I look at libs.js I can see it's a concatenation of files from the Vendor package.

Is the responsibility on me (the developer) to decide whether to include standard or minified versions of these libs, or should it be the responsibility of grunt to minify them anyway?

Cheers,
Ian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.