When I create a project, I first create a project.json file (used internally, not as part of some package). Then for some projects I run yeoman with our own custom generators.
What I would like is for yeoman to pick up my projects.json and read that instead of prompting me for settings.
Is this possible, and if so; how do I do this? Basically I think I need to know:
How do I load the file from the project-root into index.js (and defer to prompts if it doesn't exist)
How to I bind the properties from the json to 'this'.
A Yeoman generator is just a searchable and composable Node.js project running within the context of Yeoman.
As so, it can do anything.
So, if you want to write a generator reading a project.json configuration file to know what to generate - well just do it!
http://yeoman.io/authoring/
Related
I am designing a very big application now and i want to make good infrastructure for the future.
In Razor (MVC) there is an option to include javascript files in a view by using the function #Scripts.Render("~/Scripts/myscript.js") by specify a specific file or bundle item from BundleCollection which defined in BundleConfig.cs.
I am wondering, is there any added value to define a bundle item in the Scripts.Render function of only single file instead of specify the script file itself?
one of added value i found is that in the long run i will be able to add more files to the bundle as needed without changing the views that using it and i will enjoy the optimization. but i couldn't find added value for that while i am still using one js file in the "bundle".
There is a couple of benefits actually apart from the one you have mentioned:
Bundles are minified in release mode. When you add a file to the bundle (even a single file) and reference the bundle in the view the code will be minified. It's not the case when you reference the file directly. That's most probably what you're going for in production.
The framework generates and appends a random hash to the script with every new version of the bundle to invalidate the cache of the previous bundles. It looks something like this <script src="/bundles/myscript.js?v=CQJxkNd9QnrvutTyUG9mM-vD0FrbCc1"></script>. Your clients will thank you for this after every new release. And again - it doesn't happen if you reference the file directly unless you generate and append the versions manually.
So what I usually do, and I consider it a good practice until I'm proven wrong, I create a bundle for every page specific needs even if it consists of a single js file with a tiny module. For example Home page:
bundles.Add(new ScriptBundle("~/bundles/home").Include("~/Scripts/home.js"));
#Scripts.Render("~/bundles/home")
Is this possible, if yes, how would I go about it?
I have some subgenerators, which install express, wordpress or drupal. You can also name the install folder and name the assets folders (css/js/images). I'd like to pass those folder names to the parent generator for templating.
Variables can be pass through options/arguments when using composition. This only flows from the parent to the children.
There's no way for the children to pass back values to the parent generator. This is by design.
Better way is to rely on configuration files like package.json or infer settings from the content of files in the destination folder. This is better because that mean your generator is loosely couple to match the architecture of any existing project or any other generators your end user might want to compose with.
What We Have:
In our project we download the wsdl from nexus repository using maven.
Maven has been used for generating the stub class.
If we take a look into the stub class, it will have the WSDL path like "C:\Documents\target...."
Now the problem is if we deploy this package in development server where this path have no relevance.
Logically what we are thinking as part of the solution:
WSDL should be part of our project directory
and generated stub class should take the project context path instead of the path mentioned earlier.
Hope that is what we have to do logically, if our thinking logically wrong please correct us.
What Solution we Need:
Putting the WSDL file in project path, and change the POM file so that it will generate the stub using the WSDL which have in local.
Generated path should refer the WSDL from project directory instead of "C:\Documents\target...."
Looking for your help and support.
if you generated stub once. you need not to generate it again.
as far as wsdl location is concern put it in your project and specify the location inside the program
I'm trying to add some Markdown capabilities to my Symfony project (Symfony version 1.3.3).
To accomplish that, I had already included the Markdown library into lib/vendor directory. Also, I added the need configuration in the autoload.yml for the previous library.
However, I'm getting a fatal PHP error:
Call to undefined function Markdown()
How can I resolve this problem?
The symfony autoloader loads classes from php files named like <classname>.class.php. If you're using the markdown.php file from mitchelf.com, it does not follow the naming scheme, nor does it contain a class called Markdown, as a matter of fact: it has a function called Markdown.
Symfony isn't even trying to load it, for reasons I described above. You will have to include it manually. I suggest you have a look at http://www.symfony-project.org/plugins/sfEasyMarkdownPlugin.
I do NOT suggest installing a plugin for such a simple feature. It is not hard for you to figure it out if you have some real examples.
There is an open source project based on symfony named Bookeet. It has embedded MarkDowm feature. It uses markitup as the markdown editor. And it uses php markdown to convert markdown code to html code.
To save your time, go directly to changeset 29f0ba1807 of the Bookeet project(I am sorry that I can't post the hyperlink because SO doesn't permit new user to post more than one hyperlink). You could see clearly what should be done in order to add markdown feature to your website.
I am using Symfony 1.31 for a brand new project. I have just created a module in the backend app, using the admin generator. To my suprise, it seems no theme ((At all) has been applied to the pages. As I mentioned before, this si abrand new project - I have not even modified the /app/backend/layout.php file yet.
I rember having a similar problem before - I dont remmber how I solved it (I think I had to run a task or copy some files over to the /web folder before the styles/images etc came into efect. Can anyone refresh my memory?
You might need to run the plugin:publish-assets command:
php symfony plugin:publish-assets
This will create symlinks to your plugins' web/ directory inside your project's web/, thus enabling access to sfDoctrinePlugin's (or propel depending what ORM you use) admin-gen styles.
Check your apache configuration and files permissions, and especially the alias to the /sf/ subdirectory. It seems that the .css file corresponding to sf_admin pages are not accessible. You can fix it by adding an Alias to your virtualhost configuration, or allowing symlinks.
(By the way, hint: check your html source, find out the .css url, and try to access it directly with your browser)