Browse Source

gruntfils

develop
Robin Thoni 8 years ago
parent
commit
f40d6a1dca
8 changed files with 189 additions and 26 deletions
  1. 1
    0
      .gitignore
  2. 0
    17
      Gruntfile.js
  3. 148
    0
      Gruntfile_admin.js
  4. 5
    2
      admin/index.html
  5. 0
    0
      admin/less/app.less
  6. 9
    7
      camotion/index.html
  7. 0
    0
      camotion/less/app.less
  8. 26
    0
      package.json

+ 1
- 0
.gitignore View File

@@ -4,3 +4,4 @@ docs
4 4
 .tmp
5 5
 .idea/
6 6
 .DS_Store
7
+/build

+ 0
- 17
Gruntfile.js View File

@@ -1,17 +0,0 @@
1
-module.exports = function(grunt) {
2
-
3
-  grunt.initConfig({
4
-      uglify: {
5
-          demo: {
6
-              files: {
7
-                  'dest/output.min.js': ['camotion/**/*.js']
8
-              }
9
-          }
10
-      }
11
-  });
12
-
13
-  grunt.loadNpmTasks('grunt-contrib-uglify');
14
-
15
-  grunt.registerTask('default', ['uglify']);
16
-
17
-};

+ 148
- 0
Gruntfile_admin.js View File

@@ -0,0 +1,148 @@
1
+/**
2
+ * Created by robin on 11/10/15.
3
+ */
4
+
5
+module.exports = function(grunt) {
6
+
7
+    grunt.loadNpmTasks('grunt-contrib-clean');
8
+    grunt.loadNpmTasks('grunt-usemin');
9
+    grunt.loadNpmTasks('grunt-contrib-concat');
10
+    grunt.loadNpmTasks('grunt-contrib-uglify');
11
+    grunt.loadNpmTasks('grunt-contrib-copy');
12
+    grunt.loadNpmTasks('grunt-contrib-cssmin');
13
+    grunt.loadNpmTasks('grunt-contrib-less');
14
+
15
+    var path = require('path');
16
+
17
+    grunt.initConfig({
18
+        globals: {
19
+            releasePath: 'build/release/admin',
20
+            appFolder: 'admin',
21
+            staticFiles: [
22
+                'views/**/*.html',
23
+                'index.html',
24
+                'img/**',
25
+                'fonts/**'
26
+            ]
27
+        },
28
+        useminPrepare: {
29
+            release: '<%= globals.appFolder %>/index.html',
30
+            options: {
31
+                flow: {
32
+                    release: {
33
+                        steps: {
34
+                            'js': [
35
+                                'concat',
36
+                                {
37
+                                    name: 'uglify',
38
+                                    createConfig: function (context, block) {
39
+                                        var cfg = {files: []},
40
+                                            filesDef = {};
41
+
42
+
43
+                                        filesDef.dest = path.join('<%= globals.releasePath %>', block.dest);
44
+                                        filesDef.src = [];
45
+                                        context.inFiles.forEach(function (inFile) {
46
+                                            filesDef.src.push(path.join(context.inDir, inFile));
47
+                                        });
48
+
49
+                                        cfg.files.push(filesDef);
50
+                                        return cfg;
51
+                                    }
52
+                                }
53
+                            ],
54
+                            'css': ['concat',
55
+                                {
56
+                                    name: 'cssmin',
57
+                                    createConfig: function (context, block) {
58
+                                        var cfg = {files: []},
59
+                                            filesDef = {};
60
+
61
+
62
+                                        filesDef.dest = path.join('<%= globals.releasePath %>', block.dest);
63
+                                        filesDef.src = [];
64
+                                        context.inFiles.forEach(function (inFile) {
65
+                                            filesDef.src.push(path.join(context.inDir, inFile));
66
+                                        });
67
+
68
+                                        cfg.files.push(filesDef);
69
+                                        return cfg;
70
+                                    }
71
+                                }],
72
+                            'less': [
73
+                                {
74
+                                    name: 'less',
75
+                                    createConfig: function (context, block) {
76
+                                        var cfg = {files: []},
77
+                                            filesDef = {};
78
+
79
+                                        context.options.generated.options = {
80
+                                            cleancss: true
81
+                                        };
82
+
83
+                                        filesDef.dest = path.join('<%= globals.releasePath %>', block.dest);
84
+                                        filesDef.src = [];
85
+                                        context.inFiles.forEach(function (inFile) {
86
+                                            filesDef.src.push(path.join(context.inDir, inFile));
87
+                                        });
88
+
89
+                                        cfg.files.push(filesDef);
90
+                                        return cfg;
91
+                                    }
92
+                                }
93
+                            ]
94
+                        },
95
+                        post: {
96
+
97
+                        }
98
+                    }
99
+                }
100
+            }
101
+        },
102
+        usemin: {
103
+            html: '<%= globals.releasePath %>/index.html',
104
+            options: {
105
+                blockReplacements: {
106
+                    less: function (block) {
107
+                        return '<link rel=\"stylesheet\" href=\"' + block.dest + '\"/>';
108
+                    }
109
+                }
110
+            }
111
+        },
112
+        copy: {
113
+            release: {
114
+                files: [
115
+                    {
116
+                        expand: true,
117
+                        cwd:'<%= globals.appFolder %>/',
118
+                        src: ['<%= globals.staticFiles %>'],
119
+                        dest: '<%= globals.releasePath %>'
120
+                    },
121
+                    {
122
+                        expand: true,
123
+                        cwd:'<%= globals.appFolder %>/../bower_components/flat-ui/dist/fonts/',
124
+                        src: [
125
+                            '**'
126
+                        ],
127
+                        dest: '<%= globals.releasePath %>/fonts/'
128
+                    }
129
+                ]
130
+            }
131
+        },
132
+        clean: {
133
+            release: ['<%= globals.releasePath %>/*']
134
+        }
135
+    });
136
+    grunt.registerTask('release', [
137
+        'clean:release',
138
+        'useminPrepare:release',
139
+        'concat:generated',
140
+        'uglify:generated',
141
+        'copy:release',
142
+        'cssmin:generated',
143
+        'less:generated',
144
+        'usemin'
145
+    ]);
146
+
147
+
148
+};

+ 5
- 2
admin/index.html View File

@@ -5,13 +5,16 @@
5 5
     <meta charset="utf-8">
6 6
     <title>Camotion Administration</title>
7 7
 
8
-    <!-- build:css css/css.css -->
8
+    <!-- build:css css/globals.css -->
9 9
     <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css">
10 10
     <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
11 11
     <link rel="stylesheet" href="../bower_components/luticate-utils/src/lubusy.css">
12 12
     <link rel="stylesheet" href="../bower_components/JSONedit/css/styles.css"/>
13 13
     <link rel="stylesheet" href="../bower_components/flat-ui/dist/css/flat-ui.css">
14
-    <link rel="stylesheet/less" href="css/app.less">
14
+    <!-- endbuild -->
15
+
16
+    <!-- build:less css/styles.css -->
17
+    <link rel="stylesheet/less" href="less/app.less">
15 18
     <!-- endbuild -->
16 19
 
17 20
     <!-- build:js app.js -->

admin/css/app.less → admin/less/app.less View File


+ 9
- 7
camotion/index.html View File

@@ -5,12 +5,14 @@
5 5
     <meta charset="utf-8">
6 6
     <title>Camotion</title>
7 7
 
8
-    <!-- build:css css/css.css -->
9
-    <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css">
8
+    <!-- build:css css/globals.css -->
10 9
     <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
11 10
     <link rel="stylesheet" href="../bower_components/luticate-utils/src/lubusy.css">
12 11
     <link rel="stylesheet" href="../bower_components/flat-ui/dist/css/flat-ui.css">
13
-    <link rel="stylesheet/less" href="css/app.less">
12
+    <!-- endbuild -->
13
+
14
+    <!-- build:less css/styles.css -->
15
+    <link rel="stylesheet/less" href="less/app.less">
14 16
     <!-- endbuild -->
15 17
 
16 18
     <!-- build:remove -->
@@ -27,16 +29,16 @@
27 29
     <script src="../bower_components/angular/angular.js"></script>
28 30
     <script src="../bower_components/angular-ui-router/release/angular-ui-router.js"></script>
29 31
     <script src="../bower_components/angular-bootstrap/ui-bootstrap.js"></script>
30
-    <script src="../bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
31
-    <script src="../bower_components/angular-local-storage/dist/angular-local-storage.min.js"></script>
32
+    <script src="../bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
33
+    <script src="../bower_components/angular-local-storage/dist/angular-local-storage.js"></script>
32 34
     <script src="../bower_components/bootstrap/js/collapse.js"></script>
33 35
     <script src="../bower_components/bootstrap/js/transition.js"></script>
34 36
     <script src="../bower_components/bootstrap/js/dropdown.js"></script>
35 37
     <script src="../bower_components/less/dist/less-1.7.4.js"></script>
36
-    <script src="../bower_components/luticate-utils/dist/luticate-utils.min.js"></script>
37
-    <script src="../bower_components/luticate-auth/dist/luticate-auth.min.js"></script>
38 38
     <script src="../bower_components/angular-dialog-service/dist/dialogs.js"></script>
39 39
     <script src="../bower_components/angular-sanitize/angular-sanitize.js"></script>
40
+    <script src="../bower_components/luticate-utils/dist/luticate-utils.min.js"></script>
41
+    <script src="../bower_components/luticate-auth/dist/luticate-auth.min.js"></script>
40 42
 
41 43
     <!-- scripts -->
42 44
     <script src="app.js"></script>

camotion/css/app.less → camotion/less/app.less View File


+ 26
- 0
package.json View File

@@ -0,0 +1,26 @@
1
+{
2
+  "name": "camotion",
3
+  "version": "0.1.0",
4
+  "description": "Camotion front",
5
+  "main": "app.js",
6
+  "dependencies": {},
7
+  "devDependencies": {
8
+    "grunt": "~0.4.5",
9
+    "grunt-contrib-clean": "~0.6.0",
10
+    "grunt-usemin": "~3.1.1",
11
+    "grunt-contrib-concat": "~0.5.1",
12
+    "grunt-contrib-uglify": "~0.10.0",
13
+    "grunt-contrib-copy": "~0.8.2",
14
+    "grunt-contrib-cssmin": "~0.14.0",
15
+    "grunt-contrib-less": "~1.1.0"
16
+  },
17
+  "scripts": {
18
+    "test": "echo \"Error: no test specified\" && exit 1"
19
+  },
20
+  "repository": {
21
+    "type": "git",
22
+    "url": "git:camotion-v2/front"
23
+  },
24
+  "author": "",
25
+  "license": "MIT"
26
+}

Loading…
Cancel
Save