{"id":424,"date":"2018-03-02T10:55:25","date_gmt":"2018-03-02T05:25:25","guid":{"rendered":"http:\/\/blog.openwebsolutions.in\/?p=424"},"modified":"2018-03-02T11:17:08","modified_gmt":"2018-03-02T05:47:08","slug":"what-is-nuxt-js","status":"publish","type":"post","link":"https:\/\/openwebsolutions.in\/blog\/what-is-nuxt-js\/","title":{"rendered":"What is Nuxt.js?"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>Nuxt.js is a framework for creating Universal Vue.js Applications.<\/p>\n<p>Its main scope is\u00a0<strong>UI rendering<\/strong>\u00a0while abstracting away the client\/server distribution. It is used to create a framework flexible enough that you can use it as a main project base or in addition to current project based on Node.js.<\/p>\n<p>Nuxt.js presets all the configuration needed to make development of a Vue.js Application\u00a0<strong>Server Rendered<\/strong>\u00a0more reliable.<\/p>\n<p>As a framework, Nuxt.js comes with a lot of features to help\u00a0a development between the client side and the server side such as Asynchronous Data, Middleware, Layouts, etc.<\/p>\n<p>&nbsp;<\/p>\n<h2>Features of Nuxt.js<\/h2>\n<p>&nbsp;<\/p>\n<p><em>Write Vue Files (<code>*.vue<\/code>)<\/em><\/p>\n<p><em>Automatic Code Splitting<\/em><\/p>\n<p><em>Server-Side Rendering<\/em><\/p>\n<p><em>Powerful Routing System with Asynchronous Data<\/em><\/p>\n<p><em>Static File Serving<\/em><\/p>\n<p><em>ES6\/ES7 Transpilation<\/em><\/p>\n<p><em>Bundling and minifying of your JS &amp; CSS<\/em><\/p>\n<p><em>Managing\u00a0<code>&lt;head&gt;<\/code>\u00a0element (<code>&lt;title&gt;<\/code>,\u00a0<code>&lt;meta&gt;<\/code>, etc.)<\/em><\/p>\n<p><em>Hot module replacement in Development<\/em><\/p>\n<p><em>Pre-processor: Sass, Less, Stylus, etc.<\/em><\/p>\n<p><em>HTTP\/2 push headers ready<\/em><\/p>\n<p><em>Extending with Modular architecture<\/em><\/p>\n<p>&nbsp;<\/p>\n<h2>Create a Nuxt JS application<\/h2>\n<p>&nbsp;<\/p>\n<p>Creating a Nuxt.js application from scratch is also really easy, it only needs\u00a0<em>1 file and 1 directory<\/em>. Let&#8217;s create an empty directory to start working on the application:<\/p>\n<p><em>$ mkdir &lt;project-name&gt;<\/em><br \/>\n<em> $ <span class=\"hljs-built_in\">cd<\/span> &lt;project-name&gt;<\/em><\/p>\n<p>The project needs a\u00a0<code>package.json<\/code>\u00a0file to specify how to start\u00a0<code>nuxt<\/code>:<\/p>\n<p><em>{ <\/em><\/p>\n<p><em><span class=\"hljs-attr\">\u00a0 \u00a0 &#8220;name&#8221;<\/span>: <span class=\"hljs-string\">&#8220;my-app&#8221;<\/span>, <\/em><\/p>\n<p><em><span class=\"hljs-attr\">\u00a0 \u00a0 &#8220;scripts&#8221;<\/span>: { <\/em><\/p>\n<p><em><span class=\"hljs-attr\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0&#8220;dev&#8221;<\/span>: <span class=\"hljs-string\">&#8220;nuxt&#8221;<\/span> <\/em><\/p>\n<p><em>\u00a0 \u00a0 }<\/em><\/p>\n<p><em> }<\/em><\/p>\n<p><code>scripts<\/code>\u00a0will launch Nuxt.js via\u00a0<code>npm run dev<\/code>.<\/p>\n<p>&nbsp;<\/p>\n<p>Once the\u00a0<code>package.json<\/code>\u00a0has been created, add\u00a0<code>nuxt<\/code>\u00a0to the project via npm:<\/p>\n<p><em>npm install &#8211;save nuxt<\/em><\/p>\n<p>&nbsp;<\/p>\n<h2>The pages directory<\/h2>\n<p>&nbsp;<\/p>\n<p>Nuxt.js will transform every\u00a0<code>*.vue<\/code>\u00a0file inside the\u00a0<code>pages<\/code>\u00a0directory as a route for the application.<\/p>\n<p>Create the\u00a0<code>pages<\/code>\u00a0directory:<\/p>\n<p><em>$ mkdir pages<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>then create the first page in\u00a0<code>pages\/index.vue<\/code>:<\/p>\n<p><em><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">template<\/span>&gt;<\/span> <\/em><\/p>\n<p><em><span class=\"hljs-tag\">\u00a0 \u00a0 &lt;<span class=\"hljs-name\">h1<\/span>&gt;<\/span>Hello world!<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h1<\/span>&gt;<\/span> <\/em><\/p>\n<p><em><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">template<\/span>&gt;<\/span><\/em><\/p>\n<p>&nbsp;<\/p>\n<p>and launch the project with:<\/p>\n<p><em>$ npm run dev<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>The application is now running on\u00a0<em><a href=\"http:\/\/localhost:3000\/\">http:\/\/localhost:3000<\/a>.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>That&#8217;s it, How cool this is. This is an initial way of creating a Nuxt js project.<\/p>\n<p>Hope you like it and please don&#8217;t forget to share.<\/p>\n<p>&nbsp;<\/p>\n<p>Source courtesy :\u00a0<em><a href=\"https:\/\/nuxtjs.org\/\">https:\/\/nuxtjs.org\/<\/a><\/em><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Nuxt.js is a framework for creating Universal Vue.js Applications. Its main scope is\u00a0UI rendering\u00a0while abstracting away the client\/server distribution. It is used to create a framework flexible enough that you can use it as a main project base or in addition to current project based on Node.js. Nuxt.js presets all the configuration needed to [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":425,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,5],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is Nuxt.js? - Openweb Solutions Blog<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/openwebsolutions.in\/blog\/what-is-nuxt-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Nuxt.js? - Openweb Solutions Blog\" \/>\n<meta property=\"og:description\" content=\"&nbsp; Nuxt.js is a framework for creating Universal Vue.js Applications. Its main scope is\u00a0UI rendering\u00a0while abstracting away the client\/server distribution. It is used to create a framework flexible enough that you can use it as a main project base or in addition to current project based on Node.js. Nuxt.js presets all the configuration needed to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/openwebsolutions.in\/blog\/what-is-nuxt-js\/\" \/>\n<meta property=\"og:site_name\" content=\"Openweb Solutions Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-02T05:25:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-02T05:47:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2018\/03\/banner.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"497\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/\",\"name\":\"Openweb Solutions Blog\",\"description\":\"Transforming ideas into reality\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/openwebsolutions.in\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/what-is-nuxt-js\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2018\/03\/banner.png\",\"width\":1024,\"height\":497,\"caption\":\"banner\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/what-is-nuxt-js\/#webpage\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/what-is-nuxt-js\/\",\"name\":\"What is Nuxt.js? - Openweb Solutions Blog\",\"isPartOf\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/what-is-nuxt-js\/#primaryimage\"},\"datePublished\":\"2018-03-02T05:25:25+00:00\",\"dateModified\":\"2018-03-02T05:47:08+00:00\",\"author\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/615090f954d8460cf6186cf920b47398\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/openwebsolutions.in\/blog\/what-is-nuxt-js\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/615090f954d8460cf6186cf920b47398\",\"name\":\"Preetam Mallick\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ed836329485e177373e4ff5323b6670a?s=96&r=g\",\"caption\":\"Preetam Mallick\"},\"description\":\"Frontend developer at Openweb Solutions\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/424"}],"collection":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/comments?post=424"}],"version-history":[{"count":7,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/424\/revisions"}],"predecessor-version":[{"id":432,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/424\/revisions\/432"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media\/425"}],"wp:attachment":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media?parent=424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/categories?post=424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/tags?post=424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}