yeoman-generator

Yeoman: Call Sub-Generator With User-Supplied Arguments

一笑奈何 提交于 2019-12-02 17:40:24
I'm writing my first Yeoman generator, which prompts the user for various inputs and conditionally creates files based on their responses. I need to be able to call a subroutine (could be a Yeoman sub-generator) based on user input, and pass arguments to it. The reason I want to use named functions (which are not automatically run) is that sometimes the user's response should invoke a number of functions combined, and sometimes the function should be run alone. What I have tried: I figured sub-generators were the way to go, since I'm creating sets of files only if the user requests them. But I

Can Yeoman generators update existing files?

点点圈 提交于 2019-12-02 15:34:02
So just to give you some context, I'm trying to create a generator that will create some files (based on user input of course) as well as update some existing files in the project (like adding a new route for example). Creating the files using this.template is no problem... the question is: is there any way to do this with Yeoman without having to read the file using Node and doing some fanciful find and replace? Remy Ok, so I found the answer to my question. Addy Osmani showed me where to look in this thread on twitter , and then I later found this link which shows exactly what I need. The

Gulp-useref is throwing error: “path must be a string”

▼魔方 西西 提交于 2019-12-02 12:03:57
问题 I'm using a gulpfile.js generated by yeoman's gulp-webapp generator and modified slightly by me to fit my needs. For some reason I keep running into an issue when I try to run the build process(default task). The error is thrown during the 'html' task and most of the error references are in `node_modules\gulp-useref\index.js'. Here is the error output: stream.js:94 throw er; //Unhandled stream in pipe. TypeError: path must be a string at Object.fs.openSync (fs.js:427:18) at Object.fs

Lots of “npm ERR!”s when running `yo angular`

混江龙づ霸主 提交于 2019-12-02 01:54:05
问题 I'm trying to get Yeoman to work but it's been one wall after another. Thank God for stackoverflow and all you nice people helping out. Anyways ... I've been trying to run yo angular . But I'm getting a bunch of npm ERR! including: npm ERR! Please try running this command again as root/Administrator. Since I can't use sudo on yo, I followed the mostly accepted advice and changed some configuration hoping to fix this problem. Here are the commands I ran, which were based on the recommendation.

grunt usemin doesnt affect the html file(index.html)

北城余情 提交于 2019-12-01 16:32:16
i have a grunt script that uses usemin but the weird thing is is that the index.html file is not affected by usemin at all! it means that my file still has all the <!-- build:css styles/main.css --> <link rel="stylesheet" href="styles/style.css"> <link rel="stylesheet" href="styles/bs-growl-notifications.css"> <!-- endbuild --> the weirdest part in the log is this(it does nothing although it found the blocks-see full log): Processing as HTML - dist/index.html Update the HTML to reference our concat/min/revved script files Update the HTML with the new css filenames Update the HTML with the new

Renaming single file names while copying entire folder using copyTpl

只愿长相守 提交于 2019-12-01 12:06:21
My yeoman generator copies files from template to destination path: this.fs.copyTpl( this.templatePath(), this.destinationPath(), { appName: this.props.appName }); During project generation, I need to assign value of this.props.appName to some of filenames. Unfortunately I can't do this that way like I could do inside this files: <%=appName%>-project.sln All files that need to be renamed have appTemplate in their names, so what I need to do is simply replace appTemplate with value of this.props.appName . Can I somehow configure copyTpl to rename some of files while copying them to another

Renaming single file names while copying entire folder using copyTpl

穿精又带淫゛_ 提交于 2019-12-01 09:55:19
问题 My yeoman generator copies files from template to destination path: this.fs.copyTpl( this.templatePath(), this.destinationPath(), { appName: this.props.appName }); During project generation, I need to assign value of this.props.appName to some of filenames. Unfortunately I can't do this that way like I could do inside this files: <%=appName%>-project.sln All files that need to be renamed have appTemplate in their names, so what I need to do is simply replace appTemplate with value of this

generator-angular module is not creating a new project

给你一囗甜甜゛ 提交于 2019-12-01 04:18:16
I am new to yeoman set of tools. I run following commands in Ubuntu 12 $ npm install -g yo $ npm install -g generator-webapp $ yo webapp I am able to create a web app project. After that I tried to create an angular project. First I run a command $ npm install -g generator-angular And no error is displayed with installation of this generator. When I run the command $ yo angular I get the error: Error angular You don't seem to have a generator with the name angular installed. You can see available generators with npm search yeoman-generator and then install them with npm install [name]. To see

generator-angular module is not creating a new project

醉酒当歌 提交于 2019-12-01 01:19:04
问题 I am new to yeoman set of tools. I run following commands in Ubuntu 12 $ npm install -g yo $ npm install -g generator-webapp $ yo webapp I am able to create a web app project. After that I tried to create an angular project. First I run a command $ npm install -g generator-angular And no error is displayed with installation of this generator. When I run the command $ yo angular I get the error: Error angular You don't seem to have a generator with the name angular installed. You can see

How to update the JHipster project after updating JHipster generator?

爱⌒轻易说出口 提交于 2019-11-30 06:41:54
I updated my JHipster installation as per this page by running the command npm update -g generator-jhipster But to update my application I am not sure where should I run the next command yo jhipster . I tried running it from the root of existing project, but it asked me to enter the name of the new project. I tried running it at one level above the root of existing project, then also it asked me the name of the new project. But this time I entered the same name and the jhipster generation process ran. However there was no change in any of the major files like package.json or Gruntfile.js or