Merge pull request #668 from pi0/fixes

Fixes
This commit is contained in:
Sébastien Chopin 2017-05-05 16:50:31 +02:00 committed by GitHub
commit 05085cbc99
5 changed files with 15 additions and 6 deletions

View File

@ -7,6 +7,9 @@
<script>
<% if (loading) { %>import NuxtLoading from '<%= (typeof loading === "string" ? loading : "./components/nuxt-loading.vue") %>'<% } %>
<% css.forEach(function (c) { %>
import '<%= c.src || c %>'
<% }) %>
let layouts = {
<%
@ -61,6 +64,3 @@ export default {
}
</script>
<% css.forEach(function (c) { %>
<style src="<%= (typeof c === 'string' ? c : c.src) %>" lang="<%= (c.lang ? c.lang : 'css') %>"></style>
<% }) %>

View File

@ -3,14 +3,12 @@
import { each, defaults } from 'lodash'
import webpack from 'webpack'
import VueSSRClientPlugin from 'vue-server-renderer/client-plugin'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import HTMLPlugin from 'html-webpack-plugin'
import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'
import ProgressBarPlugin from 'progress-bar-webpack-plugin'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import OfflinePlugin from 'offline-plugin'
import base from './base.config.js'
import { extractStyles } from './helpers'
import { resolve } from 'path'
/*

3
test/fixtures/with-config/assets/app.css vendored Executable file
View File

@ -0,0 +1,3 @@
.global-css-selector {
color: red;
}

View File

@ -31,5 +31,8 @@ module.exports = {
extend (config, options) {
config.devtool = 'nosources-source-map'
}
}
},
css: [
{src: '~/assets/app.css'}
]
}

View File

@ -24,6 +24,11 @@ test('/', async t => {
t.true(html.includes('<h1>I have custom configurations</h1>'))
})
test('/ (global styles inlined)', async t => {
const { html } = await nuxt.renderRoute('/')
t.true(html.includes('.global-css-selector'))
})
test('/ (custom app.html)', async t => {
const { html } = await nuxt.renderRoute('/')
t.true(html.includes('<p>Made by Nuxt.js team</p>'))