AngularJS-ResponsiveCalendar 使用教程
1. 项目的目录结构及介绍
AngularJS-ResponsiveCalendar/
├── css/
│ ├── rcalendar/
│ └── rcalendar-demo/
├── demo/
├── dist/
│ ├── css/
│ └── js/
├── src/
│ └── rcalendar/
├── template/
│ └── rcalendar/
├── .gitignore
├── .jshintrc
├── LICENSE.txt
├── README.md
├── bower.json
├── gruntfile.js
└── package.json
css/
: 包含样式文件。demo/
: 包含演示页面。dist/
: 包含构建后的文件。src/
: 包含源代码。template/
: 包含模板文件。.gitignore
: Git忽略配置文件。.jshintrc
: JSHint配置文件。LICENSE.txt
: 许可证文件。README.md
: 项目说明文件。bower.json
: Bower依赖管理文件。gruntfile.js
: Grunt任务配置文件。package.json
: NPM依赖管理文件。
2. 项目的启动文件介绍
项目的启动文件主要是 demo/index.html
,这是一个演示页面,展示了如何使用 AngularJS-ResponsiveCalendar
指令。
<!DOCTYPE html>
<html ng-app="demo">
<head>
<link rel="stylesheet" href="../dist/css/calendar.min.css"/>
<script src="../dist/js/calendar-tpls.min.js"></script>
<script>
var demo = angular.module('demo', ['ui.rCalendar']);
</script>
</head>
<body>
<calendar calendar-mode="mode"></calendar>
</body>
</html>
3. 项目的配置文件介绍
bower.json
: 定义了项目的 Bower 依赖。
{
"name": "ng-responsive-calendar",
"version": "0.1.0",
"description": "A pure AngularJS responsive calendar directive",
"main": "dist/js/calendar-tpls.min.js",
"dependencies": {
"angular": "~1.2.0"
}
}
package.json
: 定义了项目的 NPM 依赖和脚本。
{
"name": "ng-responsive-calendar",
"version": "0.1.0",
"description": "A pure AngularJS responsive calendar directive",
"main": "dist/js/calendar-tpls.min.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-cssmin": "^2.2.1",
"grunt-contrib-uglify": "^3.0.1",
"grunt-contrib-watch": "^1.0.0"
}
}
gruntfile.js
: 定义了 Grunt 任务,用于构建和压缩项目文件。
module.exports = function(grunt) {
grunt.initConfig({
concat: {
js: {
src: ['src/rcalendar/*.js'],
dest: 'dist/js/calendar.js'
},
css: {
src: ['css/rcalendar/*.css'],
dest: 'dist/css/calendar.css'
}
},
cssmin: {
target: {
files: {
'dist/css/calendar.min.css': ['dist/css/calendar.css']
}
}
},
uglify: {
my_target: {
files: {
'dist/js/calendar-tpls.min.js': ['dist/js/calendar.js']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib