A project template to jumpstart a Perl Dancer/Angular application
What it does
It's designed to be used to create an AngularJS Single Page Application (SPA) using Perl Dancer as a backend.
- AngularJS application template with examples for directives, services, controllers and filters.
- Perl Dancer (version 1 and 2) application to use as a backend. Also contains templates to configure popular Dancer plugins like: Dancer::Plugin::Database, Dancer::Plugin::Auth::Extensible and Dancer::Plugin::DBIC.
- web package manager (bower) to include popular packages like AngularJS, Bootstrap, jQuery and Font Awesome.
- task runner (grunt) to help automate concatenation and minification of web project assets (js/css) for production.
- node.js package manager (npm) to manage node.js modules.
- perl and perl module managers (plenv and carton) to locally install perl and perl modules.
You need the following softwares installed on your system:
- Perl Dancer 1 or 2: Install
$ git clone git://github.com/jacqueslareau/perl-dancer-angular-seed.git MyApp $ cd MyApp $ npm install $ bower install
For a Dancer2 project, check the bin/app.pl file.
Start the app in development mode:
And then point your browser to:
Remove git remote:
$ git remote rm origin
To deploy for production, create a script that will clone your project in your production folder. Your script will then have to run the following commands to install needed packages and modules:
$ npm install $ bower install $ carton install $ grunt
You can declare your AngularJS source files and css files in dancer's config.yml file.
assets: js: build-folder: "public/app/build" build-file: "app.js" build-file-min: "app.min.js" files: - "public/app/app.js" - "public/app/directives/MyDirective.js" - "public/app/services/MyService.js" - "public/app/filters/MyFilter.js" - "public/app/controllers/MyController.js" css: build-folder: "public/css/build" build-file: "styles.css" build-file-min: "styles.min.css" files: - "public/css/styles.css"
This is used by grunt to build the files that will be used in production.
Be sure to use AngularJS array notation to declare functions. It is required to make sure uglify doesn't break your code.