草庐IT

grunt-typescript

全部标签

javascript - 在 Grunt 中使用全局变量设置构建输出路径

我有几个繁重的任务,我试图在这些任务之间共享全局变量,但我遇到了问题。我已经编写了一些自定义任务,这些任务根据构建类型设置正确的输出路径。这似乎设置正确。//SetMode(localorbuild)grunt.registerTask("setBuildType","Setthebuildtype.Eitherbuildorlocal",function(val){//grunt.log.writeln(val+":setBuildTypeval");global.buildType=val;});//SetOutputlocationgrunt.registerTask("setO

javascript - Grunt 任务陷入无限循环

正在为一些即将开展的项目构建基础Gruntfile.js。从一台新电脑开始,一切都是全新的。使用Homebrew安装了Node和NPM,然后在全局以及我的本地目录中安装了Grunt。这是我的package.json:{"name":"timespent-prototype","version":"0.1.0","devDependencies":{"assemble":"0.4.37","bower":"^1.4.1","grunt":"^0.4.5","grunt-contrib-concat":"^0.5.1","grunt-contrib-sass":"^0.9.2","grun

javascript - Visual Studio -> Shared TypeScript Library -> TS6059 文件 '' 不在 'rootDir' '' 下。 'rootDir' 应该包含所有源文件

我们正在使用VisualStudio2017并且有两个独立的Web项目,它们应该共享一些用TypeScript编写的React组件。还可以共享JavaScript文件和CSS文件。为此,我们在VisualStudio中创建了一个共享项目。WhatisthedifferencebetweenaSharedProjectandaClassLibraryinVisualStudio2015?目前该项目只有一个包含此信息的文件。exportconstTypes={Type1:'1',Type2:'2',Type3:'3'}为了测试,我可以像这样引用它,VisualStudio将找到该文件:im

javascript - 如何让 'grunt less' 自动运行 autoprefixer?

我有一个带有less和autoprefixer的工作Gruntfile。我也有'gruntwatch'工作正常。在我使用autoprefixer之前,我使用较少的mixin作为vendor前缀。运行'gruntless'将构建带有我所有前缀的工作CSS。现在我有了autoprefixer,但如果我想一次性构建我的样式,我现在必须先运行“gruntless”然后运行“gruntautoprefixer”才能使用带前缀的CSS。我如何修改'gruntless'使其能够正常工作,再次减少前缀?I'vereadthedocs,andIknowIcouldaddanadditionaltaskt

javascript - 简单网站的 Grunt + require.js 配置

我的网站有以下简单结构:srcjscore.jsmain.jslibjquery-1.8.2.jsrequire-2.1.1.jsrequire-text.jstemplates1.html2.htmlindex.htmlbuild我希望将所有js+lib文件编译成一个build/js/main.js文件,而其他文件只复制到build文件夹中。如何为此任务编写grunt.js配置?看来我应该使用grunt-contrib-require..第二个问题是如何将1.html和2.html(我使用requiretext!插件)编译成一行并将这些行包含到build/js/main.js中?在这

javascript - 在 Typescript 中导入 Chai

我正在尝试在typescript中使用chai。Chai的javascript示例显示为:varshould=require('chai').should();我下载了类型定义:tsdinstallchai...引用文件,尝试导入///importshould=require('chai').should();我得到:errorTS1005:';'expected...知道怎么做吗? 最佳答案 import{should}from'chai';should(); 关于javascript

javascript - 使用 d3.js 和 TypeScript 绘制饼图时出现编译错误

我正在尝试使用d3.js库和TypeScript绘制饼图。我有以下代码:"usestrict";moduleChart{exportclasschart{privatechart:d3.Selection;privatewidth:number;privateheight:number;privateradius:number;privatedonutWidth:number;privatedataset:{label:string,count:number}[];privatecolor:d3.scale.Ordinal;constructor(container:any){this

javascript - 在 grunt/requirejs 构建期间设置/取消设置调试标志

我从两个requirejs开始和gruntjs.我在应用程序中有一个调试标志,如:vardebugEnabled=true;有什么方法可以将其设置为false,在grunt构建中运行的requirejs优化中自动设置?编辑:澄清一下,我只有一个运行requirejs优化器的默认任务。变量debugEnabled位于我的应用程序本身的模块之一内,例如AppLogger,它依赖于main。requirejs构建是否可以通过某种方式将此变量设置为false,以便AppLogger的缩小版本停止执行console.log等 最佳答案 @as

javascript - typescript 的/** @class */有目的吗?

我正在学习typescript,我注意到编译后的javascript对每个类都有一个注释,如下所示:/**@class*/例子:varStudent=/**@class*/(function(){functionStudent(firstName,middleInitial,lastName){this.firstName=firstName;this.middleInitial=middleInitial;this.lastName=lastName;this.fullName=firstName+""+middleInitial+""+lastName;}returnStudent

javascript - Angular2 - 类型错误 : Cannot read property 'Id' of undefined in (Typescript)

我收到以下错误:angular2.dev.js:23925EXCEPTION:TypeError:Cannotreadproperty'Id'ofnullin[{{product.Id}}inProductEditComponent@0:68]抛出://Product-edit.component.ts:import{Component}from'angular2/core';import{IProduct}from'./product'import{ProductService}from'./product.service'import{RouteParams}from'angula