早午餐,基础6,jquery问题

时间:2016-03-06 22:36:50

标签: jquery zurb-foundation brunch zurb-foundation-6

我很难让我的JS在这个非常简单的Foundation / jQuery网站上工作。没什么特别的,只是一个很好的老式HTML页面。在早午餐方面,一切都在编译,文件正在生成。问题是javascript没有在浏览器中运行。没有错误消息 - 只是没有执行(我认为)。看下面,你会看到console.log(),但它没有在网络检查器中返回任何内容

的package.json

{
  "name": "your-app",
  "description": "Description",
  "author": "Your Name",
  "version": "0.0.1",
  "repository": {
    "type": "git",
    "url": ""
  },
  "scripts": {
    "start": "brunch watch --server"
  },
  "dependencies": {
    "autoprefixer": "^5.2.0",
    "babel-brunch": "^5.1.2",
    "browser-sync-brunch": "0.0.9",
    "brunch": "^2.4.2",
    "css-brunch": "^1.7.0",
    "foundation-sites": "^6.2.0",
    "javascript-brunch": "^1.7.1",
    "jquery": "^1.12.1",
    "motion-ui": "^1.2.2",
    "postcss-brunch": "^0.5.0",
    "sass-brunch": "^1.8.11",
    "scut": "^1.4.0"
  }
}

Brunch-config.coffee

exports.config =
  npm:
    enabled: true
    globals:
      $: 'jquery'
      jQuery: 'jquery'
      Foundation: 'foundation-sites'

  files:
    javascripts:
      joinTo:
        'js/app.js': /^app/
        'js/vendor.js': /^node_modules/

    stylesheets:
      joinTo: 'css/app.css'

  plugins:
    sass:
      options:
        includePaths: [
          'node_modules/foundation-sites/scss'
          'node_modules/motion-ui/src'
          'node_modules/scut/dist'
        ]
    postcss:
      processors: [
        require('autoprefixer')({browsers: ['last 2 versions', 'ie >= 9']})
      ]

公共/ app.js

$(document).foundation();

console.log("it works");

的index.html

<!doctype html>
<html class="no-js" lang="en">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Hi</title>
    <link rel="stylesheet" href="css/app.css">
</head>
<body>
    hi
<script src="/js/vendor.js"></script>
<script src="/js/app.js"></script>
</body>
</html>

0 个答案:

没有答案