Selaa lähdekoodia

Move client javascript from package.json to bower.json

Sotaro KARASAWA 11 vuotta sitten
vanhempi
sitoutus
f0a9e58989
7 muutettua tiedostoa jossa 72 lisäystä ja 77 poistoa
  1. 25 18
      Gruntfile.js
  2. 3 1
      bower.json
  3. 2 3
      package.json
  4. 1 0
      public/bower_components
  5. 26 18
      resource/css/crowi-reveal.scss
  6. 2 12
      views/layout/layout.html
  7. 13 25
      views/page_presentation.html

+ 25 - 18
Gruntfile.js

@@ -32,7 +32,8 @@ module.exports = function(grunt) {
           outputStyle: 'nested',
           outputStyle: 'nested',
           includePaths: [
           includePaths: [
             'bower_components/bootstrap-sass-official/assets/stylesheets',
             'bower_components/bootstrap-sass-official/assets/stylesheets',
-            'bower_components/fontawesome/scss'
+            'bower_components/fontawesome/scss',
+            'bower_components/reveal.js/css'
           ]
           ]
         },
         },
         files: {
         files: {
@@ -45,7 +46,8 @@ module.exports = function(grunt) {
           outputStyle: 'compressed',
           outputStyle: 'compressed',
           includePaths: [
           includePaths: [
             'bower_components/bootstrap-sass-official/assets/stylesheets',
             'bower_components/bootstrap-sass-official/assets/stylesheets',
-            'bower_components/fontawesome/scss'
+            'bower_components/fontawesome/scss',
+            'bower_components/reveal.js/css'
           ]
           ]
         },
         },
         files: {
         files: {
@@ -56,25 +58,30 @@ module.exports = function(grunt) {
     },
     },
     concat: {
     concat: {
       dist: {
       dist: {
-        src: [
-          // Bootstrap
-          'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js',
-          // socket.io
-          'node_modules/socket.io-client/dist/socket.io.js',
-          // markd
-          'bower_components/marked/lib/marked.js',
-          // jquery.cookie
-          'bower_components/jquery.cookie/jquery.cookie.js',
-          // crowi
-          'resource/js/crowi.js'
-        ],
-        dest: '<%= dirs.jsDest %>/<%= pkg.name %>.js'
-      }
+        files: {
+          '<%= dirs.jsDest %>/<%= pkg.name %>.js': [
+            'bower_components/jquery/dist/jquery.js',
+            'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js',
+            'node_modules/socket.io-client/dist/socket.io.js',
+            'bower_components/marked/lib/marked.js',
+            'bower_components/jquery.cookie/jquery.cookie.js',
+            'resource/js/crowi.js'
+          ],
+          '<%= dirs.jsDest %>/<%= pkg.name %>-reveal.js': [
+            'bower_components/jquery/dist/jquery.js',
+            'bower_components/reveal.js/lib/js/head.min.js',
+            'bower_components/reveal.js/lib/js/html5shiv.js',
+            'bower_components/reveal.js/js/reveal.js'
+          ],
+        }
+      },
     },
     },
     uglify: {
     uglify: {
       build: {
       build: {
-        src: '<%= concat.dist.dest %>',
-        dest: '<%= dirs.jsDest %>/<%= pkg.name %>.min.js'
+        files: {
+          '<%= dirs.jsDest %>/<%= pkg.name %>.min.js': '<%= dirs.jsDest %>/<%= pkg.name %>.js',
+          '<%= dirs.jsDest %>/<%= pkg.name %>-reveal.min.js': '<%= dirs.jsDest %>/<%= pkg.name %>-reveal.js'
+        }
       }
       }
     },
     },
     jshint: {
     jshint: {

+ 3 - 1
bower.json

@@ -22,6 +22,8 @@
     "bootstrap-sass-official": "~3.3.1",
     "bootstrap-sass-official": "~3.3.1",
     "fontawesome": "~4.2.0",
     "fontawesome": "~4.2.0",
     "jquery.cookie": "~1.4.1",
     "jquery.cookie": "~1.4.1",
-    "marked": "~0.3.3"
+    "marked": "~0.3.3",
+    "reveal.js": "~3.0.0",
+    "jquery": "~2.1.3"
   }
   }
 }
 }

+ 2 - 3
package.json

@@ -20,7 +20,7 @@
   "dependencies": {
   "dependencies": {
     "async": "~0.9.0",
     "async": "~0.9.0",
     "aws-sdk": "~2.0.0-rc.19",
     "aws-sdk": "~2.0.0-rc.19",
-    "bower": "~1.3.9",
+    "bower": "~1.3.12",
     "cli": "~0.6.4",
     "cli": "~0.6.4",
     "connect-flash": "~0.1.1",
     "connect-flash": "~0.1.1",
     "connect-redis": "^2.1.0",
     "connect-redis": "^2.1.0",
@@ -32,7 +32,7 @@
     "googleapis": "=0.4.7",
     "googleapis": "=0.4.7",
     "grunt": "~0.4.1",
     "grunt": "~0.4.1",
     "grunt-cli": "~0.1.13",
     "grunt-cli": "~0.1.13",
-    "grunt-contrib-concat": "~0.3.0",
+    "grunt-contrib-concat": "~0.5.0",
     "grunt-contrib-jshint": "^0.10.0",
     "grunt-contrib-jshint": "^0.10.0",
     "grunt-contrib-uglify": "~0.2.2",
     "grunt-contrib-uglify": "~0.2.2",
     "grunt-contrib-watch": "~0.5.3",
     "grunt-contrib-watch": "~0.5.3",
@@ -41,7 +41,6 @@
     "mongoose-paginate": "~3.1.0",
     "mongoose-paginate": "~3.1.0",
     "nodemailer": "~1.2.2",
     "nodemailer": "~1.2.2",
     "nodemailer-ses-transport": "~1.1.0",
     "nodemailer-ses-transport": "~1.1.0",
-    "reveal.js": "~2.6.2",
     "socket.io": "~0.9.16",
     "socket.io": "~0.9.16",
     "socket.io-client": "~0.9.16",
     "socket.io-client": "~0.9.16",
     "swig": "=1.3.2",
     "swig": "=1.3.2",

+ 1 - 0
public/bower_components

@@ -0,0 +1 @@
+../bower_components

+ 26 - 18
resource/css/crowi-reveal.scss

@@ -1,4 +1,5 @@
-//@import "../../node_modules/reveal.js/css/theme/template/theme";
+@import 'reveal';
+@import 'theme/source/black';
 
 
 .reveal {
 .reveal {
   font-size: 32px;
   font-size: 32px;
@@ -6,38 +7,44 @@
     font-family: "Lucida Grande", "Hiragino Kaku Gothic Pro W3", Meiryo, san-serif;
     font-family: "Lucida Grande", "Hiragino Kaku Gothic Pro W3", Meiryo, san-serif;
   }
   }
 
 
-  section {
-    text-align: left;
+  .slides > section {
+    //text-align: left;
+    padding: 0;
 
 
     &.only.present {
     &.only.present {
-      top: -25%;
       h1, h2, h3, h4, h5, h6 {
       h1, h2, h3, h4, h5, h6 {
         font-size: 2.5em;
         font-size: 2.5em;
       }
       }
     }
     }
 
 
-    h1, h2, h3, h4, h5, h6 {
-      margin-bottom: 1em;
-      font-weight: bold;
-      line-height: 1.2em;
-      text-transform: none;
-      text-align: left;
-      text-shadow: none;
-    }
+    p {
+      line-height: 1.6;
 
 
-    p, ul li, ol li {
-      line-height: 1.3em;
+      &:first-child {
+        margin-top: 0;
+      }
     }
     }
 
 
-    p {
-      margin-top: .5em;
+    pre {
+      code {
+        padding: 20px 40px;
+      }
+    }
+    blockquote {
+      width: 80%;
+      padding: 20px 60px;
     }
     }
 
 
     ul {
     ul {
       margin-top: .2em;
       margin-top: .2em;
       margin-bottom: .1em;
       margin-bottom: .1em;
-      li {
-        margin-bottom: .2em;
+      > li {
+        line-height: 1.6;
+        margin-bottom: .5em;
+
+        > ul > li {
+          font-size: .85em;
+        }
       }
       }
     }
     }
 
 
@@ -116,6 +123,7 @@
         }
         }
       }
       }
     }
     }
+    // }}}
 
 
   }
   }
 }
 }

+ 2 - 12
views/layout/layout.html

@@ -11,19 +11,9 @@
 
 
   <meta name="viewport" content="width=device-width,initial-scale=1">
   <meta name="viewport" content="width=device-width,initial-scale=1">
 
 
-  {% if env  == 'development' %}
-  <link rel="stylesheet" href="/css/crowi.css">
-  {% else %}
-  <link rel="stylesheet" href="/css/crowi.min.css">
-  {% endif %}
-
-  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
+  <link rel="stylesheet" href="/css/crowi{% if env  == 'production' %}.min{% endif %}.css">
+  <script src="/js/crowi{% if env  == 'production' %}.min{% endif %}.js"></script>
   <link href='//fonts.googleapis.com/css?family=Maven+Pro:400,700' rel='stylesheet' type='text/css'>
   <link href='//fonts.googleapis.com/css?family=Maven+Pro:400,700' rel='stylesheet' type='text/css'>
-  {% if env  == 'development' %}
-  <script src="/js/crowi.js"></script>
-  {% else %}
-  <script src="/js/crowi.min.js"></script>
-  {% endif %}
 </head>
 </head>
 {% endblock %}
 {% endblock %}
 
 

+ 13 - 25
views/page_presentation.html

@@ -6,10 +6,10 @@
     <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
     <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
 
 
-    <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/css/reveal.min.css">
-    <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/css/theme/solarized.css">
+
     <link rel="stylesheet" type="text/css" href="/css/crowi-reveal.css">
     <link rel="stylesheet" type="text/css" href="/css/crowi-reveal.css">
-    <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/lib/css/zenburn.css">
+    <link rel="stylesheet" type="text/css" href="/bower_components/reveal.js/lib/css/zenburn.css">
+
     <title>{{ path|path2name }} | {{ path }}</title>
     <title>{{ path|path2name }} | {{ path }}</title>
   </head>
   </head>
   <body>
   <body>
@@ -17,7 +17,7 @@
       <div class="slides">
       <div class="slides">
         <section data-markdown data-separator="^\n\n\n">
         <section data-markdown data-separator="^\n\n\n">
           <script type="text/template">
           <script type="text/template">
-{{ revision.body|presentation }}
+{{ revision.body|presentation|safe }}
 
 
 
 
 
 
@@ -27,38 +27,26 @@
       </div>
       </div>
     </div>
     </div>
 
 
-    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
-    <script src="//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/lib/js/head.min.js"></script>
-    <script src="//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/js/reveal.min.js"></script>
+    <script src="/js/crowi-reveal.js"></script>
     <script>
     <script>
-
-      // Full list of configuration options available here:
-      // https://github.com/hakimel/reveal.js#configuration
       Reveal.initialize({
       Reveal.initialize({
         controls: true,
         controls: true,
         progress: true,
         progress: true,
         history: true,
         history: true,
-        center: false,
-
-        theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
-        transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
-
-        // Parallax scrolling
-        // parallaxBackgroundImage: 'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg',
-        // parallaxBackgroundSize: '2100px 900px',
+        center: true,
+        transition: 'slide',
 
 
         // Optional libraries used to extend on reveal.js
         // Optional libraries used to extend on reveal.js
         dependencies: [
         dependencies: [
-          { src: '//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/lib/js/classList.js', condition: function() { return !document.body.classList; } },
-          { src: '//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
-          { src: '//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
-          { src: '//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
-          { src: '//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
-          { src: '//cdnjs.cloudflare.com/ajax/libs/reveal.js/2.5/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
+          { src: '/bower_components/reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
+          { src: '/bower_components/reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
+          { src: '/bower_components/reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
+          { src: '/bower_components/reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
+          { src: '/bower_components/reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
+          { src: '/bower_components/reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
         ]
         ]
       });
       });
 
 
-      //
       Reveal.addEventListener('ready', function(event) {
       Reveal.addEventListener('ready', function(event) {
         // event.currentSlide, event.indexh, event.indexv
         // event.currentSlide, event.indexh, event.indexv
         $('.reveal section').each(function(e) {
         $('.reveal section').each(function(e) {