1. obviel
  2. Untitled project
  3. obviel

Commits

Martijn Faassen  committed 29b4850

Some sketched out grunt + bower + requirejs stuff. I don't really know
yet what I'm doing but it appears to work for obviel core so far.

  • Participants
  • Parent commits 5ceb04f
  • Branches amd

Comments (0)

Files changed (5)

File .hgignore

View file
  • Ignore whitespace
 *.pyc
 *.jslex
 node_modules
-
+components

File Gruntfile.js

View file
  • Ignore whitespace
+module.exports = function(grunt) {
+
+  // Project configuration.
+  grunt.initConfig({
+    pkg: grunt.file.readJSON('package.json'),
+    bower: {
+        target: {
+            rjsConfig: 'rjs.js'
+        }
+    },
+    requirejs: {
+        compile: {
+            options: {
+                name: 'obviel',
+                mainConfigFile: 'rjs.js',
+                out: "obviel.js"
+            }
+        }
+    }
+  });
+
+  // Load the plugin that provides the "uglify" task.
+  grunt.loadNpmTasks('grunt-requirejs');
+  grunt.loadNpmTasks('grunt-bower-requirejs');
+  // Default task(s).
+  grunt.registerTask('default', ['bower', 'requirejs']);
+
+};

File package.json

View file
  • Ignore whitespace
+{
+  "name": "obviel",
+  "version": "1.0b7",
+  "devDependencies": {
+    "grunt": "~0.4.1",
+    "grunt-contrib-jshint": "~0.1.1",
+    "grunt-contrib-nodeunit": "~0.1.2",
+    "grunt-requirejs": "~0.3.5",
+    "grunt-bower-requirejs": "~0.4.2"
+  }
+}

File rjs.js

View file
  • Ignore whitespace
+require.config({
+    "baseUrl": "src/obviel",
+    "paths": {
+        "jquery": "../../components/jquery/jquery"
+    }
+});

File src/obviel/obviel.js

View file
  • Ignore whitespace
 /*global jsontemplate:false alert:false */
+define(['jquery'], function($) {    
+    var obviel = {};
 
-if (typeof obviel === "undefined") {
-    var obviel = {};
-}
+// if (typeof obviel === "undefined") {
+//     var obviel = {};
+// }
 
-if (typeof console === "undefined") {
-    var console = {
-        log: function(text) {
-        }
-    };
-}
+// if (typeof console === "undefined") {
+//     var console = {
+//         log: function(text) {
+//         }
+//     };
+//}
 
-(function($) {
     // a fallback i18n module that doesn't do any translation.
     // this way we can use obviel with the obviel i18n API without
     // actually having to load obviel-i18n.js. of course it won't
         }
     );
 
-}(jQuery, obviel));
+    return obviel;
+}); // (jQuery, obviel));