Wrthe iteme your next Web application wthe itemh Ember CLI


Wrthe iteme your next Web application wthe itemh Ember CLI

Advertis actuallying

When you start a fresh web project or begin to delve into the exis actuallyting code base, rather are you trying to create or strengthen a function for users. The The last thing you want to do is actually spend time setting means of building along wthe itemh the creation of infrastructure for application development. If you lalong wthe itemh a fresh client, you want to show them is actually today, not a week after being cobbled together inside the construction of the pipeline.

As you may already kcurrently, Amber is actually "confident" Web JavaScript framework focused on creating an ambthe itemious, rich client Web applications. Technologically, Amber posthe itemioning the itemself as a antidote hype fatigue . This particular actually structure, which is actually just do not die , yet keeps pressing on wthe itemh every innovation , along wthe itemh wthe itemh a commthe itemment to backward compatibilthe itemy.

Amber CLI is actually a common solution for the communthe itemy Ember foreground snap. It provides a productive along wthe itemh functionally rich experience inside the development of the box.

Call trivial select Link

At first glance, the front end of construction tools seem too diverse for a common solution. There are too many factors to take into account, along wthe itemh each project has the items own needs of the event. As stated inside the documentation page React to " Integration Tool " "Every project uses a different system to build along wthe itemh deploy JavaScript."

you use Rails along wthe itemh .NET? That CSS preprocessor do you use? Is your application consis actuallyts of 1 page, or 'is actuallylalong wthe itemhs' wealth? Do you use a global JavaScript, Asynchronous Module Definthe itemion (AMD), a universal definthe itemion module (UMD), CommonJS or ECMAScript 6 modules? What is actually the scope of testing do you prefer?

As the needs of developers vary so much, the low-level development tools, such as a breath, Grant along wthe itemh broccoli are often the starting point for the front-end development. Sergeant, lineman along wthe itemh brunch take us further, generating a template required for different use cases.

So how does the item differ Amber CLI? Doing Amber CLI official build tool for Ember, the communthe itemy receives the default set of tools which are integrated 225 Amber CLI deposthe itemors along wthe itemh battle-tested around the clock by the user communthe itemy Ember. These tools provide a useful convention, clear the way to best practices, along wthe itemh get away via burden of trivial choices . As Chris actually Eppstein wrote , referring to the language Sass, "It is actually our belief which the item contriyetes to a dynamic sequence, along wthe itemh the item is actually more benefthe item than" just for me "approach."

Some developers might find the item difficult to refuse a choice in favor of performance. I might argue which we have to become experts inside the field in which we work, along wthe itemh for most developers, this actually domain is actually the intersection of business along wthe itemh the development of the serviced client application. Frankly, I had never heard of the development team which created the build tools they were happy wthe itemh. However, I have seen custom build tools have dis actuallyastrous consequences for the projects. You have to try Ember CLI, before creating your own.

New Features Link

Amber CLI does not only on the construction of assets better than before. When the communthe itemy around merges technology, fresh opportunthe itemies for productivthe itemy occur. Here are some of the innovations which are made possible wthe itemh Ember CLI.

  • Ember plugins
    These libraries, which can be installed inside the application Ember CLI along wthe itemh "just work" wthe itemh zero configuration.
  • Amber Deployment CLI
    This particular actually is actually for the normal front-end deployment.
  • Amber FastBoot
    Render Amber applications on the server for a faster inthe itemial page load.

Ansome other side effect of Ember CLI, developers get the latest along wthe itemh greatest technology, the item does not even need to kcurrently which exis actuallyts. Out of the box, Amber CLI applications have ECMAScript transpilation Babel, lively congestion inside the design, along wthe itemh easy way to AJAX proxy requests to local or remote server.

let's create Amber App Link

Before creating applications Amber CLI, you will need to install Node.js. You can find out how to install the item on the websthe iteme [1945006Nodejs], or you can use the common Homebrew project, if your computer is actually running Mac OS X:

  kvas set node  

then set herself Amber CLI:

  NPM installation -g coal-CLI  

Wthe itemh the prerequis actuallythe itemes out of the way, you are ready to create the items first application Ember:

  ember fresh my application  

Once this actually is actually completed, go to the directory of your application ( CD MY-application ), run the application ember serve , along wthe itemh vis actuallythe item Local :. 40 to see your application in action

A freshly minted Ember CLI app
freshly minted Amber CLI application. ( View Larger )

The use Amber CLI Link

Using drawings feature Ember CLI, let's add a lthe itemtle meat to our application, along wthe itemh Show the lis actuallyt of messages, when a user vis actuallythe items / [1945053soobscheniya] URL. You can also follow accompanying the reposthe itemory Gthe itemHub

  ember g Messages Resource name :. Line body: String  

This particular actually suggests Ember CLI to generate Posts resource - the item creates [маршрут[1945053записьввашеммаршрутизаторемаршрутасообщенийшаблонипочтовоемодельСообщениемодельбудетиметьзаголовокителоатрибутыкоторыебросаютвстроки

We have to cycle through our posthe itemions along wthe itemh give them our messages template. The every Assis actuallytant makes the item possible to APP / templates / posts.hbs

   Message . 

post.tthe itemle

post.body / each

Next, we want to find our messages along wthe itemh data transfer the item via a template when a user vis actuallythe items / posts . We retrieved messages in our product, crochet communications route, located on APP / routes / posts.js .

  Default export Ember.Route.extend (/ / Add this actually method product () return this actually.store.findAll ("Post"););  

You may have noticed which we used the abbreviated syntax for ECMAScript 6 objects to determine product method . Because Amber transpiler JavaScript, CLI uses the default, we expect to see modern JavaScript code in most applications Lent.

We could have just wrthe itemten some JavaScript objects for the mail data in our route here along wthe itemh called the item a day, yet let's go a lthe itemtle further along wthe itemh actually bring messages via the server.

We generate Express web server to serve some of the data in our application.

  Ember g-HTTP posts format  

Then we return some dummy data of / API / posts . Edthe item the generated Server / mocks / posts.js file to return some of the data via the index of the route.

  postsRouter.get ('/', function (REQ, RES) res.send ('messages: [// Add these objects ID: 1 Tthe itemle: "First post" body: "Blogging ', ID: 2 Tthe itemle:" Second message "body:" Blogging again']););  

The last thing we need is actually to set Amber data adapter.

  ember g adapter applications  

To ensure which Amber data kcurrentlys to find a message on / API / posts , we add our names to the adapter APP / adapters / application.js .

  Default export DS.RESTAdapter.extend (namespace "api" // Add this actually)  

Now, if you vis actuallythe item Local :. 40 / posts , you will see a message in all their glory

Your client-rendered lis actuallyt of posts
Your client provided a lis actuallyt of messages. ( View Larger )

Of course, you'll probably want to connect an application to a real web server at some point inside the development process. When you're ready, you can remove the format of the server along wthe itemh run the application proxy options:

  Ember s --proxy HTTP: // Localhost: 3000  

In this actually commalong wthe itemh, Replace HTTP: // local :. 3000 via local or remote web server

This particular actually is actually a great way to instantly build your front end along wthe itemh the transthe itemion to the production web server later.

The use Amber plugins Link

If you are familiar wthe itemh the use of Bauer along wthe itemh NPM to install dependencies, you may Amber plugins impress you.

Let's set up along wthe itemh use date-picker in our application Ember. My choice is actually a collector of Pikaday . Fortunately, some people have integrated the library wthe itemh Ember CLI. Here we will use ember-pikaday addon.

  ember ember set-pikaday  

Now, let's create a file inside the app / templates / index.hbs along wthe itemh try the item

  pikaday-input value = date format = 'MM / DD / YYYY 

you have selected .: date

A Pikaday date-picker rendered as an Ember component
code Pikaday Date-Picker appears as a component of Ember. ( View Larger )

This particular actually addon installed Pikaday along wthe itemh Moment.js , the item provided a component named Ember pikaday-entry , along wthe itemh included Pikaday CSS in our assembly -. all wthe itemh 1 commalong wthe itemh to set

test Link

integration of application code, the scope of testing along wthe itemh the test runner can be a daunting task. You want to run the unthe item tests for individual parts of the code along wthe itemh complex tests against a running application. You may also want to run tests via the commalong wthe itemh line for continuous integration testing on the build server.

Let's wrthe iteme a test for page messages, which we did before. ". Quote," We start by creating an acceptance test called

  ember Mr. posts transceiver test  

Now you can vis actuallythe item HTTP: // local :. 40 / Tests to see the test runs

16 passing tests already
Sixteen tested already. ( View large product of )

We have 16 test? It's right. Our generators via the previously created each test to help us begin, along wthe itemh every one of our files has been tested wthe itemh JSHint errors.

Let's fill the generated acceptance test wthe itemh something which tells us which our posthe itemions are. provided

  test ("Seen / messaging function (to state) vis actuallythe item ('/ messages.'); along wthe itemhThen (function () tthe itemles VAR = find ('H3') ToArray (). map ((el) => el.textContent); assert.deepEqual (name ['Start', 'Second Message'] "has both tthe itemles");););  

This particular actually test is actually run our application Ember in an is actuallyolated part of the test runner, vis actuallythe itemed posts path, along wthe itemh then argues which the tthe itemle of each post on the page. The along wthe itemhThen Assis actuallytant wathe iteming for asynchronous processing to stop before approval.

If you are not an avid tester, you might find yourself running out of excuses to Ember CLI. If you get excthe itemed about testing, you'll find the item easier than ever to get commenced. Drawings to place the current best practices at your fingertips, so you do not have to spend time searching Google ", to see how [x] in Amber."

Jump to the production of Link

Before sending the code to production, you want to optimize speed, minimize the code prints the items assets along wthe itemh relate these fingerprints assets [1945053indexhtml] file [

You can do all which wthe itemh 1 commalong wthe itemh, which puts the items production ready files in / [1945053rasstoyanie] directory.

  ember assembly --environment = "production"  

After your assets are being built for the production, the next step is actually to deploy them to a remote server. Many users choose to integrate Ember CLI build them files wthe itemh the same deployment process they use to code the server server. However, emerging best practices refined along wthe itemh defended Luke Melia to to use a separate interface working deployment , which allows your application to be deployed Amber regardless of your server-side code.

On EmberConf 2015 Luca announced , accompanied by outstalong wthe itemhing add-ons for deployment have joined forces to create one addon called Amber CLI Deploy. The freshly formed team has released their first joint effort, product 0.5.0 addon.

Amber Deployment CLI cover "basic along wthe itemh plug-ins" archthe itemecture . Supplements provides workflow deployment, yet users install different plugins depending on the exact infrastructure they use. For example, one installation proposed by Luke uses the Amazon S3 service to host files along wthe itemh Redis actually storage along wthe itemh communication index.html file applications in Ember.

You can set the current add-on, using the same team we've seen before installation:

  ember ember install CLI-deployment of  

We also set ugolek- CLI-assembly to build our application for the production of

  ember install coal-CLI-assembly  

From there, you can set the asset adapter plug which you need:

  ember ember installation -cli deploy-S3  

Then, you need to install plug-in index adapter, which allows the interconnection of your index.html file on the server

  ember ember set-CLI-Deploy-Redis actually  

Finally, you can edthe item your Config / deploy.js file to include information about Redis actually along wthe itemh S3, creating sure which Amber Deployment CLI can interact wthe itemh these services.

C is actually installed along wthe itemh configured, these adapters can be deployed wthe itemh 1 commalong wthe itemh.

  ember expalong wthe itemh production --activate  

The commalong wthe itemh:

  • to build their assets for the production of
  • upload your assets JavaScript along wthe itemh CSS, to S3,
  • load your index.html file wthe itemh Redis actually,
  • "activate" the last [1945053indexhtml] file which was downloaded .

In this actually sequence of events, only at the last stage of activation, modifies the product of the application Ember, which is actually supplied to users. Previous products of index.html stored on Redis actually, along wthe itemh the previous product of your assets are stored on S3. To swthe itemch to a running application product of Ember, developers use to activate the commalong wthe itemh to tell your server to use a particular [1945053indexhtml] file, which is actually pointing to a set of assets which are stored on S3.

  ember expalong wthe itemh: including production --revis actuallyion 44f2f92  

To learn more about how you can deploy the application infrastructure Ember, cash documentation Ember- CLI-deployment .

not only for Amber Link

All this actually talk about the elimination of trivial choices may have left you wthe itemh the impression which Amber CLI is actually not flexible or customized. Because Amber CLI must accommodate a wide range of use cases via the communthe itemy, the item includes a clearly defined public interface to configure. In fact, despthe iteme the name, Amber is actually not a requirement for Ember CLI. For example, a team of Firefox OS is actually used wthe itemh Ember CLI addon created , rather than creating your own build tool.

Suppose you want all of the wonderful features of Ember CLI wthe itemhout Amber. Again, you can follow along in accompanying the reposthe itemory Gthe itemHub , if you like. We will start wthe itemh a fresh application Amber CLI:

  is actually not a fresh non-ember ember  

Next, we get rid of Ember because the item's not in our assembly JavaScript. We will remove Ember Ember along wthe itemh data of [1945053bowerjson] file

  // The bower.json {... "dependency":.: {"Amber": "2.2. 0" Thank you. . That's cool! Therefore, please do not use keyword spamming or domain as your name, some otherwis actuallye the item will be removed. Let nothing meaningful conversation instead. Thanks for dropping by! You decide to leave a comment. That's cool! Therefore, please do not use keyword spamming or domain as your name, some otherwis actuallye the item will be removed. Let nothing meaningful conversation instead. Thanks for dropping by!
Wrthe iteme your next Web application wthe itemh Ember CLI

http://mymicrostocksold.blogspot.co.id : Wrthe iteme your next Web application wthe itemh Ember CLI
Share on Google Plus

0 Response to " Wrthe iteme your next Web application wthe itemh Ember CLI "

Post a Comment