Javascript 咕噜声不响';不行。因为injector.sass丢失了?
在我的终端中,我收到以下错误: 运行“注入器:sass”(注入器)任务 正在验证配置中是否存在属性injector.sass…错误 无法处理任务。 警告:缺少必需的配置属性“injector.sass”。使用--force继续 由于警告而中止 此外,bundles/vendor.js脚本也没有加载到我的MEAN应用程序中 我的grunt文件是:Javascript 咕噜声不响';不行。因为injector.sass丢失了?,javascript,sass,gruntjs,Javascript,Sass,Gruntjs,在我的终端中,我收到以下错误: 运行“注入器:sass”(注入器)任务 正在验证配置中是否存在属性injector.sass…错误 无法处理任务。 警告:缺少必需的配置属性“injector.sass”。使用--force继续 由于警告而中止 此外,bundles/vendor.js脚本也没有加载到我的MEAN应用程序中 我的grunt文件是: /* global module, require, process */ (function(){ 'use strict'; module.exp
/* global module, require, process */
(function(){
'use strict';
module.exports = function(grunt) {
var localConfig;
try {
localConfig = require('./server/configuration/local_env.express');
} catch (e) {
localConfig = {};
}
require('jit-grunt')(grunt, {
express: 'grunt-express-server',
ngtemplates: 'grunt-angular-templates',
buildcontrol: 'grunt-build-control'
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-injector');
grunt.loadNpmTasks('grunt-angular-templates');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-build-control');
grunt.loadNpmTasks('grunt-ng-annotate');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
application: {
name: 'UPBIS B2B Social Platform',
client: require('./bower.json').appPath || 'client',
js: 'client/app/**/*.js',
dist: 'dist'
},
express: {
options: {
port: process.env.PORT || 9000
},
dev: {
options: {
script: 'server/app.js',
debug: true
}
},
prod: {
options: {
script: 'dist/server/app.js'
}
}
},
open: {
server: {
url: 'http://localhost:<%= express.options.port %>'
}
},
qunit: {
all: {
options: {
urls: ['http://localhost:9002/test.html']
}
}
},
connect: {
server: {
options: {
port: 9002,
base: './client'
}
}
},
uglify: {
options: {
banner: '/*! <%= application.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
mangle: false
},
dist: {
files: {
'dist/public/bundles/vendor.js': ['dist/public/bundles/vendor.js'],
'dist/public/bundles/code.js': ['dist/public/bundles/code.js']
}
}
},
browserify: {
dist: {
files: {
'dist/public/bundles/vendor.js': ['client/app/vendor.browserify.js'],
'dist/public/bundles/code.js': ['client/app/code.browserify.js', '<%= ngtemplates.app.dest %>']
},
}
},
jshint: {
options: {
globals: {
jQuery: true,
console: true,
module: true,
document: true
},
jshintrc: '<%= application.client %>/.jshintrc',
reporter: require('jshint-stylish')
},
server: {
options: {
jshintrc: 'server/.jshintrc'
},
src: [
'server/**/*.js',
'!server/**/*.spec.js'
]
},
serverTest: {
options: {
jshintrc: 'server/.jshintrc-spec'
},
src: ['server/**/*.spec.js']
},
all: [
'<%= application.client %>/{app,components}/**/*.js',
'!<%= application.client %>/{app,components}/**/*.spec.js',
'!<%= application.client %>/{app,components}/**/*.mock.js'
],
test: {
src: [
'<%= application.client %>/{app,components}/**/*.spec.js',
'<%= application.client %>/{app,components}/**/*.mock.js'
]
}
},
sass: { // Task
dist: { // Target
options: { // Target options
style: 'compressed',
compass: true
},
files: { // Dictionary of files
'dist/public/style.min.css': '<%= application.client %>/app/sass/style.scss' // 'destination': 'source'
}
}
},
watch: {
jshint: {
files: ['<%= application.js %>'],
tasks: ['jshint']
},
browserify: {
files: ['<%= application.js %>'],
tasks: ['browserify']
},
inject_css: {
files: ['dist/style.css'],
tasks: ['injector:css']
},
inject_bundles: {
files: ['dist/public/bundles/vendor.js', 'dist/public/bundles/code.js'],
tasks: ['injector:scripts']
},
},
ngtemplates: {
options: {
module: 'upbisApp',
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
},
},
app: {
cwd: '<%= application.client %>',
src: ['app/**/*.html'],
dest: '.tmp/templates.js'
},
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= application.client %>',
dest: '<%= application.dist %>/public',
src: [
'*.{ico,png,txt}',
'.htaccess',
'assets/**/*',
'nginx/**/*',
'index.html'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= application.dist %>/public/assets/images',
src: ['generated/*']
},
{
expand: true,
dot: true,
cwd: '<%= application.client %>/bower_components/material-design-iconic-font/dist',
dest: '<%= application.dist %>/public',
src: [
'fonts/*',
]
},
{
expand: true,
dest: '<%= application.dist %>',
src: [
'package.json',
'server/**/*'
]
}
]
},
},
env: {
test: {
NODE_ENV: 'test'
},
prod: {
NODE_ENV: 'production'
},
all: localConfig
},
injector: {
options: {
template: '<%= application.dist %>/public/index.html'
},
scripts: {
options: {
transform: function(filePath) {
filePath = filePath.replace('/dist/public/', '');
return '<script src="' + filePath + '"></script>';
},
starttag: '<!-- injector:js -->',
endtag: '<!-- endinjector -->'
},
files: {
'<%= application.dist %>/public/index.html': ['<%= application.dist %>/public/bundles/vendor.js', '<%= application.dist %>/public/bundles/code.js', ]
}
},
css: {
options: {
transform: function(filePath) {
filePath = filePath.replace('/dist/public/', '');
return '<link rel="stylesheet" href="' + filePath + '">';
},
starttag: '<!-- injector:css -->',
endtag: '<!-- endinjector -->'
},
files: {
'<%= application.dist %>/public/index.html': [
'<%= application.dist %>/public/style.min.css'
]
}
}
},
ngAnnotate: {
options: {
singleQuotes: true,
},
app: {
files: [
{
src: ['./client/app/profile/about/about.ngcontroller.js'],
expand: true,
ext: '.annotated.js',
extDot: 'last',
}
]
}
},
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= application.dist %>/*',
'!<%= application.dist %>/.git*',
'!<%= application.dist %>/.openshift',
'!<%= application.dist %>/Procfile'
]
}]
},
server: '.tmp'
},
buildcontrol: {
options: {
dir: 'dist',
commit: true,
push: true,
connectCommits: false,
message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
},
heroku: {
options: {
remote: 'git@heroku.com:aqueous-stream-9919.git',
branch: 'dist',
remoteBranch: 'master'
}
}
}
});
grunt.registerTask('express-keepalive', 'Keep grunt running', function() {
this.async();
});
grunt.registerTask('serve', function(target) {
if (target === 'dist') {
return grunt.task.run(['build', 'env:all', 'env:prod', 'express:prod', 'buildcontrol']);
}
if (target === 'debug') {
return grunt.task.run([
'clean:server',
'env:all',
'injector:sass',
'concurrent:server',
'injector',
'wiredep',
'autoprefixer',
'concurrent:debug'
]);
}
grunt.task.run([
'clean:server',
'env:all',
'injector:sass',
'concurrent:server',
'injector',
'wiredep',
'autoprefixer',
'express:dev',
'wait',
'open',
'watch'
]);
});
grunt.registerTask('build', [
'clean:dist',
'connect',
'qunit',
'jshint',
'ngtemplates',
'browserify',
'sass',
'uglify',
'copy:dist',
'injector'
]);
};
})();
/*全局模块、需求、流程*/
(功能(){
"严格使用",;
module.exports=函数(grunt){
var localConfig;
试一试{
localConfig=require('./server/configuration/local_env.express');
}捕获(e){
localConfig={};
}
要求(“jit-grunt”)(grunt{
express:“grunt express服务器”,
ngtemplates:“grunt角度模板”,
buildcontrol:“grunt生成控件”
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks(“grunt-contrib-qunit”);
grunt.loadNpmTasks(“grunt-contrib-uglify”);
grunt.loadNpmTasks(“grunt-contrib-watch”);
grunt.loadNpmTasks(“grunt-browserify”);
grunt.loadNpmTasks(“grunt-contrib-sass”);
grunt.loadNpmTasks(“grunt-injector”);
loadNpmTasks('grunt-angular-templates');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-build-control');
grunt.loadNpmTasks('grunt-ng-annotate');
grunt.initConfig({
pkg:grunt.file.readJSON('package.json'),
应用程序:{
名称:'UPBIS B2B社交平台',
客户端:require('./bower.json').appPath | |“客户端”,
js:'client/app/***.js',
dist:“dist”
},
快递:{
选项:{
端口:process.env.port | 9000
},
开发人员:{
选项:{
脚本:“server/app.js”,
调试:正确
}
},
产品:{
选项:{
脚本:“dist/server/app.js”
}
}
},
开放式:{
服务器:{
网址:'http://localhost:'
}
},
昆特:{
全部:{
选项:{
网址:['http://localhost:9002/test.html']
}
}
},
连接:{
服务器:{
选项:{
港口:9002,
基数:'./客户'
}
}
},
丑陋的:{
选项:{
横幅:'/*!*/\n',
马槽:错
},
地区:{
档案:{
'dist/public/bundles/vendor.js':['dist/public/bundles/vendor.js'],
'dist/public/bundles/code.js':['dist/public/bundles/code.js']
}
}
},
浏览:{
地区:{
档案:{
'dist/public/bundles/vendor.js':['client/app/vendor.browserify.js'],
'dist/public/bundles/code.js':['client/app/code.browserify.js','']
},
}
},
jshint:{
选项:{
全球:{
jQuery:true,
安慰:是的,
模块:正确,
文件:正确
},
jshintrc:'/.jshintrc',
记者:require('jshint-style')
},
服务器:{
选项:{
jshintrc:'server/.jshintrc'
},
src:[
'server/***/.js',
“!server/***.spec.js”
]
},
服务器测试:{
选项:{
jshintrc:'server/.jshintrc spec'
},
src:['server/***/*.spec.js']
},
全部:[
“/{app,components}/***.js”,
“!/{app,components}/***.spec.js”,
“!/{app,components}/***.mock.js”
],
测试:{
src:[
“/{app,components}/***.spec.js”,
“/{app,components}/***.mock.js”
]
}
},
sass:{//任务
距离:{//Target
选项:{//目标选项
样式:“压缩”,
罗盘:没错
},
文件:{//文件字典
'dist/public/style.min.css':'/app/sass/style.scss'/'目标':'源'
}
}
},
观察:{
jshint:{
文件:[''],
任务:['jshint']
},
浏览:{
文件:[''],
任务:['browserify']
},
注入css:{
文件:['dist/style.css'],
任务:['injector:css']
},
注入\u包:{
文件:['dist/public/bundles/vendor.js','dist/public/bundles/code.js'],
任务:['injector:scripts']
},
},
NGB模板:{
选项:{
模块:“upbisApp”,
htmlmin:{
collapseBooleanAttributes:没错,
拼贴空白:对,
RemoveAttribute属性:对,
RemovemptyAttributes:没错,
删除和声明:是的,
removeScriptTypeAttributes:true,
removeStyleLinkTypeAttributes:true
},
},
应用程序:{
cwd:“”,
src:['app/***/.html'],
dest:'.tmp/templates.js'
},
},
const config = {
injector: {
sass: {
// configuration goes here to support the task `injector.sass`
}
}
}