consitent ~/static and ~/assets aliases

closes #1257 #1241
This commit is contained in:
Pooya Parsa 2017-08-04 13:29:42 +04:30
parent 9198e0c1c7
commit 6bcfaf8a3a
6 changed files with 11 additions and 10 deletions

View File

@ -4,8 +4,8 @@
<nuxt-link to="/">NUXT BLOG</nuxt-link> <nuxt-link to="/">NUXT BLOG</nuxt-link>
</div> </div>
<p class="links"> <p class="links">
<a href="https://twitter.com/nuxt_js" target="_blank"><img src="~assets/img/twitter.png"></a> <a href="https://twitter.com/nuxt_js" target="_blank"><img src="~/assets/img/twitter.png"></a>
<a href="https://github.com/nuxt/nuxt.js/tree/dev/examples/async-component-injection" target="_blank"><img src="~assets/img/github.png"></a> <a href="https://github.com/nuxt/nuxt.js/tree/dev/examples/async-component-injection" target="_blank"><img src="~/assets/img/github.png"></a>
</p> </p>
<div class="main"> <div class="main">
<nuxt/> <nuxt/>

View File

@ -3,7 +3,7 @@
<h3 class="date">Jul 10, 2017</h3> <h3 class="date">Jul 10, 2017</h3>
<h1>Deep dive into the Ocean</h1> <h1>Deep dive into the Ocean</h1>
<div class="content"> <div class="content">
<img src="~assets/img/swimmer.jpg"> <img src="~/assets/img/swimmer.jpg">
<h2>Subtitle #1</h2> <h2>Subtitle #1</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.</p> <p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.</p>
<h2>Another subtitle</h2> <h2>Another subtitle</h2>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="container"> <div class="container">
<p><img src="~assets/nuxt.png" /></p> <p><img src="~/assets/nuxt.png" /></p>
<p>This image is included as data:image/png;base64...</p> <p>This image is included as data:image/png;base64...</p>
<p>In the source code, the files generated are based on the build.filenames data.</p> <p>In the source code, the files generated are based on the build.filenames data.</p>
<p>If you look at the <a href="/_nuxt/vendor.js">vendor.js</a>, lodash has been included (cmd/ctrl + F "lodash").</p> <p>If you look at the <a href="/_nuxt/vendor.js">vendor.js</a>, lodash has been included (cmd/ctrl + F "lodash").</p>

View File

@ -18,7 +18,7 @@ module.exports = {
/* /*
** Build configuration ** Build configuration
*/ */
css: ['tachyons/css/tachyons.min.css', '~assets/css/main.css'], css: ['tachyons/css/tachyons.min.css', '~/assets/css/main.css'],
build: { build: {
vendor: ['axios', 'gsap', 'vuex-class', 'nuxt-class-component'] vendor: ['axios', 'gsap', 'vuex-class', 'nuxt-class-component']
}, },

View File

@ -21,9 +21,9 @@ module.exports = {
/* /*
** Load Vuetify into the app ** Load Vuetify into the app
*/ */
plugins: ['~plugins/vuetify'], plugins: ['~/plugins/vuetify'],
/* /*
** Load Vuetify CSS globally ** Load Vuetify CSS globally
*/ */
css: ['~assets/app.styl'] css: ['~/assets/app.styl']
} }

View File

@ -52,10 +52,11 @@ export default function webpackBaseConfig ({ isClient, isServer }) {
'~~': join(this.options.rootDir), '~~': join(this.options.rootDir),
'@': join(this.options.srcDir), '@': join(this.options.srcDir),
'@@': join(this.options.rootDir), '@@': join(this.options.rootDir),
'static': join(this.options.srcDir, 'static'),
'~static': join(this.options.srcDir, 'static'), // Used by vue-loader so we can use in templates
// with <img src="~/assets/nuxt.png" />
'assets': join(this.options.srcDir, 'assets'), 'assets': join(this.options.srcDir, 'assets'),
'~assets': join(this.options.srcDir, 'assets') 'static': join(this.options.srcDir, 'static')
}, },
modules: [ modules: [
this.options.modulesDir, this.options.modulesDir,