Front-end development kit designed to disengage from the backend environment-IDT Server Chapter

Source: Internet
Author: User
Tags install django smarty template

IDT, a Nodejs-based, front-end development kit designed to get out of the backend environment, is designed to enable front-end development to be completely out of the back-end environment, regardless of what template engine (mainstream) the backend is capable of coping with.

IDT consists of two main parts: Server + Build, which is a major introduction to the server chapter.

In order to assist the front-end development, a local Apache-like server is not necessary, but there is a problem, if the project is HTML, PHP smarty template what to do? The use of pure static server is not possible, because for the front-end development, this HTML must be parsed by the PHP smarty template engine, the front-end personnel do not understand how PHP, can let the backend staff to help build the environment, but the project is Java, and HTML is the velocity template engine? Let the backend staff to build the Java environment ... It's so tedious. Moreover, I want to based on the interface of the front and back to self-mock data how to do? These are the problems, IDT came into being.

Integration Develop tool for Django Template, PHP Smarty, Java Velocity, Java Freemarker [integrated development tools]

In fact, the server in IDT uses the Grunt-conect component and then passes the concept of middleware to handle various types of data:

For example: What HTML middleware do is to render the HTML file that corresponds to the requested URL, with the file of its own mock data, rendered to the browser through the corresponding template engine:

Ajax middleware do the same thing.

Currently, IDT supports the rendering of the template engine for Python Django, PHP Smarty, Velocity, and Freemarker, greatly improving the efficiency of front-end development.

How to install the IDT: Portal

After the installation is complete, you can start the development, in the terminal input: Idt-v has normal output, then install normal ~

In the installed source file directory, there is a: Example-ws directory, which is the sample directory, where you can switch the various template engine, to test:

.

├──django

│├──base.html

│└──test.html

├──freemarker

│├──list.html

│├──test.tpl

│└──view.html

├──idt-config.js

├──mock

│└──html

│├──commonmock

││└──common.js

│├──django

││└──test.html.js

│├──freemarker

││└──test.tpl.js

│├──smarty

││└──test.tpl.js

│└──velocity

│└──test.html.js

├──smarty

│├──footer.tpl

│└──test.tpl

└──velocity

├──dep.html

├──header.html

└──test.html

You can copy a copy of this directory and the CD into this directory, you can directly execute:

IDT ws Start

Then this example runs and wants to end the server, just CTRL + C.

The only thing that needs to be changed when switching engines is:

    Template engine root directory "only the last parameter needs to be modified"    templates:path.join (webcontent, secondary, ' velocity '),    //Template engine switchover: Smarty/django/ Velocity/freemarker [Default velocity]    /**     * Velocity template engine with:     * https://www.npmjs.com/package/velocity     *     * The Django template engine uses ' A wrapper of Django ' s template engines ' mode (Bridging principle)     * See: Https://www.npmjs.com/package/django     * Before enabling, make sure that the Python environment is ready and then install Django:     * # pip install-v django==1.7     *//or     * # easy_install "django==1.7 *     * smarty template engine adopts:     * https://www.npmjs.com/package/nsmarty     *     * freemarker template engine adopts: (Bridging principle)     * Before enabling, make sure the Java environment and need to install: http://fmpp.sourceforge.net/     * https://www.npmjs.com/package/freemarker.js# Readme     *    /tplengine: ' Velocity ',

The 50th line in Idt-config.js, which modifies the root of the view of the template engine, and 71 rows is the configuration of the switch engine.

Another thing to note is the comment section in the code above:

Django needs to install the Python environment, and with Python installed Django, in detail, it can be viewed through the links given above;

Similarly, Freemarker also need the Java environment, and download FMPP this east, and to the Fmpp Bin directory to add environment variables;

Django and Freemarker are similar in principle, the node-level code is just a layer of wrapper, which silently removes the Python interface or Java interface from the command line to complete rendering.

IDT has more capabilities, such as reverse proxies, remote debugging, less real-time compilation (directly compiled into CSS via less middleware,less during the request process), bulk export of static files, build builds (called EDP for build), etc. The next step is to introduce each of its features slowly.

Interested in can see it's source code will understand ~

Front-end development kit designed to disengage from the backend environment-IDT Server Chapter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.