Dojo Build Profile

Translated from: https://github.com/dojo/framework/blob/master/docs/en/building/introduction.md

Dojo provides a powerful command-line tool that allows to build modern applications easier.

Can automatically create packages (Bundle), PWA can be used in the local cache file, you can build the initial stage of the rendering of HTML and CSS, you can use Dojo's CLI tool and .dojorca conditional ignore some code configuration file. Or departing (eject) Dojo build tool, constructed to directly use the bottom of the tool be completely controlled.

Features description
Dojo CLI Modular command-line tool for quick launch of new applications, create and run tests and other components.
The development server Development of local web server to use when, for monitoring file system, when a change is detected automatically rebuild. Also supports HTTPS and proxy settings.
包(bundle) By reducing the need for users to download content and applications to optimize user interaction time actually required (Time-to-Interactive) to improve the user experience. You can automatically create a package according to the route, or a well-defined package in the configuration file.
Conditional inclusion Code Through .dojorccan be closed or opened using dojo / has a function profile defined statically. Because of these configurations can not access to the code branches will be automatically ignored. This makes it easy to provide specific functionality for specific target (such as IE11 or mobile), without affecting the size of the package.
PWA Support Progressive Web applications work offline by caching content and even create a faster, more reliable user experience. Defined in the configuration file or code, dojo easy to create a service work, and constructed as part of the application.
When building rendering Rendering routes to generate the initial build HTML and CSS. When building rendering, Dojo can save the cost of the initial rendering, to create a more responsive application, and will not introduce additional complexity.

Basic Usage

Dojo provides a set of CLI commands, auxiliary create and build applications. This guide assumes that global installed @dojo/cli, and installed in the project @ dojo / cli-build-app and @ the Dojo / cli-the Test-Intern . If the project is to use the @ dojo / cli-create-app initialization, then these dependencies should already exist.

Construct

Dojo supports a variety of CLI tool or build target mode. In dojo create appas package.jsonfew scripts (scripts) generated can be seen in all modes.

Run the following command to create a production environment optimized for building.

> dojo build --mode dist

The building use distpatterns to create an application package, and outputs the result to the output/distdirectory.

Run services and monitor changes

When devor distrun mode, you can --servemark start a web server. Applications running on the default port 9999. You can use --portmarkers to modify the port. Use --watchmarkers, Dojo build tool can also monitor changes in the application and automatically rebuild.

The resulting package.jsonfile contains devscript that uses these tags to run the application builds, and listens to automatically rebuild the file on disk changes.

> dojo build --mode dev --watch file --serve

Applications will also provide source map. So the debugger can be mapped back to build JavaScript code is located src/folder on the original TypeScript code.

test

Use Dojo Intern operation unit and functional tests.

T run tests/unitthe fastest way of unit testing is to use NPM script that is created when a new Dojo application.

Command Line

# execute unit tests
npm run test:unit
# execute functional tests locally using headless Chrome and Selenium
npm run test:functional

Supported browsers

Dojo is an ongoing evolution of the framework. By default, the dojo release version will support the two most recent versions of the latest browsers. Dojo to cross-browser to the standard functions, which are required polyfill by @dojo/framework/shimon-demand. To support IE11, you need to open the --legacymark.

Dojo arrangement

You can .dojorcadd other configuration options. These options are usually available from the command line extension set, and support for more advanced features, such as an international code split, PWA list and ignore codes.

.dojorcFile contains a JSON object, you can configure information to be able to run any command on the command line tool dojo. Allocating a node for each command in the configuration object, configuration information may be stored therein.

{
    "build-app": {
        "pwa": {
            "manifest": {
                "name": "My Application",
                "description": "My amazing application"
            }
        }
    },
    "test-intern": {},
    "create-widget": {
        "tests": "tests/unit"
    }
}

In this example, @ Dojo / CLI-Build-App , @ Dojo / CLI-Test-Intern and @ dojo / cli-create-widget three modules each corresponding to a CLI command nodes. Configuration is always stratified according command => feature => arranged in the order of configuration.

Guess you like

Origin blog.51cto.com/14193089/2447363