gpt4 book ai didi

javascript - Angular 未定义 Gulp.js

转载 作者:行者123 更新时间:2023-11-28 05:54:32 27 4
gpt4 key购买 nike

我仍然有这个错误 Angular 未定义。我 99.9999% 确定这与路径配置不正确有关,但我不知道。我无法修复它!这是我现在的文件夹结构:

bower_components/
node_modules/
app/
components/
home/
controller/
homeCtrl.js
css/
home.css
home.html

shared/
css/
directives/
filters/
directives/
sass/
services/
assets/
audio/
debug/
dist/
app.min.js
vendor.min.js
lib/
etc...

gulp/
paths.js

gulpfile.js
index.html
etc....

出于某种原因,它说 Angular 未定义。

Gulpfile.js:

//Require Gulp
var gulp = require("gulp");
var ngAnnotate = require("gulp-ng-annotate");
var uglify = require("gulp-uglify");
var concat = require("gulp-concat");
var sourceMaps = require("gulp-sourcemaps");
var util = require('gulp-util');
var coffee = require("gulp-coffee")
var clean = require("gulp-clean");
var expect = require('gulp-expect-file');
var sass = require('gulp-sass');
var es = require('event-stream');
var ng_annotate = require('gulp-ng-annotate')


var base = 'app';
// var minifyCss = require('gulp-minify-css');

var paths = require("./gulp/paths");

//remove temporary directories like dist
gulp.task('clean', function() {
return gulp.src('assets/dist', {read: false})
.pipe(clean());
});

// combines all js files into one and create sourcemaps for them
gulp.task('scripts', function(done) {
gulp.src(paths.js)
.pipe(sourceMaps.init())
.pipe(concat('app.min.js'))
.pipe(ngAnnotate())
.pipe(uglify().on('error', util.log))
.pipe(sourceMaps.write('.'))
.pipe(gulp.dest(paths.dest))
.on('error', util.log)
.on('end', done);
});



gulp.task('copy', function() {
var files = ['bower_components/angular/angular.min.js'];
return gulp.src(files)
.pipe(expect(files))
});

gulp.task('watch', function() {
gulp.watch(paths.js, ['scripts'])
});

gulp.task('scripts:vendor', function() {
return gulp.src(paths.vendor_js)
// .pipe(concat(paths.vendor_js[0]))
.pipe(concat('vendor.min.js'))
.pipe(uglify().on('error', util.log))
.pipe(gulp.dest(paths.dest));
});


gulp.task('serve', function() {

})


gulp.task('default', function() {
console.log("running gulp");
});

gulp/Paths.js:

module.exports = {
dest: 'assets/dist',
js: [
'app/app.module.js',
'app/app.run.js',
'app/shared/**/*.module.js',
'app/shared/**/*.js',
'app/components/**/*.js',
'app/components/**/*.module.js'
],
sass: ['app/shared/**/*.sass'],
vendor_js: [
'bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.min.js',
'bower_components/**/*.min.js',
'assets/lib/svg-assets-cache/svg-assets-cache.js',
'assets/lib/alertifyjs/build/alertify.min.js',
'assets/lib/Recaptcha/googleRecaptchaAPI.js',
'assets/lib/angular-screenfull/angular-screenfull.min.js',
'assets/lib/screenfull/screenfull.min.js',
'assets/lib/angular-selectize/angular-selectize.js'
],
vendor_styles: [
'bower_components/selectize/dist/css/selectize.css',
'bower_components/font-awesome/css/font-awesome.min.css',
'assets/lib/alertifyjs/build/css/alertify.css',
'assets/lib/alertifyjs/build/css/themes/semantic.min.css',
'bower_components/vex/css/vex.css',
'bower_components/vex/css/vex-theme-flat-attack.css',
'assets/lib/material-charts/material-charts.min.css'
]
};

index.html:

<!DOCTYPE html>
<html lang="en" class="html_container">

<head>
<meta charset="UTF-8">
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">-->
<meta name="viewport" content="width=1200">
<title>Ng-Forum</title>

<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" href="assets/lib/alertifyjs/build/css/alertify.css" />
<link rel="stylesheet" href="assets/lib/alertifyjs/build/css/themes/semantic.min.css" />
<link rel="stylesheet" href="bower_components/vex/css/vex.css" />
<link rel="stylesheet" href="bower_components/vex/css/vex-theme-flat-attack.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/amanuel2/MathGame/master/chartjs/material-charts.min.css" type="text/css" />
<link rel="stylesheet" href="bower_components/angular-material/angular-material.css" />
<link rel="icon" href="favicon.ico">

</head>

<body ng-app="ForumApp">
<div ui-view></div>
<!--<script type="text/javascript" src="https://code.angularjs.org/1.4.9/angular.js"></script>-->
<script type="text/javscript" src="assets/dist/vendor.min.js"></script>
<script type="text/javascript" src="assets/dist/app.min.js"></script>
</body>

</html>

如果您能提供帮助,我们将不胜感激!顺便说一句,我正在 Cloud9IDE 上工作,所以如果我们可以在那里修复它,那将是快速而美妙的! https://ide.c9.io/amanuel2/ng-fourm

最佳答案

原因是我拼错了 javascript:

<script type="text/javscript" src="assets/dist/vendor.min.js"></script>

它很难找到,因为这么简单的东西可能会让你彻底失望!

关于javascript - Angular 未定义 Gulp.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37811939/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com