Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nuxt-modules/tailwindcss
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.1
Choose a base ref
...
head repository: nuxt-modules/tailwindcss
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.1.2
Choose a head ref
  • 6 commits
  • 9 files changed
  • 3 contributors

Commits on Aug 1, 2019

  1. Copy the full SHA
    5b73d24 View commit details
  2. Copy the full SHA
    a887a80 View commit details
  3. chore(docs): typo

    atinux authored Aug 1, 2019
    Copy the full SHA
    f9a052f View commit details

Commits on Aug 7, 2019

  1. Copy the full SHA
    66b4360 View commit details

Commits on Aug 8, 2019

  1. Copy the full SHA
    c2a5798 View commit details
  2. chore(release): 1.1.2

    atinux committed Aug 8, 2019
    Copy the full SHA
    a195e58 View commit details
Showing with 1,180 additions and 2,321 deletions.
  1. +7 −0 CHANGELOG.md
  2. +1 −0 README.md
  3. +14 −19 lib/module.js
  4. +1 −1 lib/utils.js
  5. +3 −3 package.json
  6. +3 −3 test/config.test.js
  7. +3 −3 test/fail.test.js
  8. +3 −5 test/ok.test.js
  9. +1,145 −2,287 yarn.lock
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.1.2](https://github.com/nuxt-community/nuxt-tailwindcss/compare/v1.1.1...v1.1.2) (2019-08-08)


### Bug Fixes

* upgrade tailwind and remove log ([c2a5798](https://github.com/nuxt-community/nuxt-tailwindcss/commit/c2a5798))

### [1.1.1](https://github.com/nuxt-community/nuxt-tailwindcss/compare/v1.1.0...v1.1.1) (2019-07-29)


1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@

- 📖 [Release Notes](./CHANGELOG.md)
- 🏀 [Online playground](https://codesandbox.io/s/o4vn5pvp7q)
- 🌿 [CSS Nesting Module Draft](https://drafts.csswg.org/css-nesting-1/)

## Setup

33 changes: 14 additions & 19 deletions lib/module.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const { join } = require('path')
const { ensureTemplateFile } = require('./utils')
const logger = require('./logger')

module.exports = async function (moduleOptions) {
const options = {
@@ -10,7 +9,6 @@ module.exports = async function (moduleOptions) {
...moduleOptions
}

const isBuild = this.options._build
const configPath = this.nuxt.resolver.resolveAlias(options.configPath)
const cssPath = this.nuxt.resolver.resolveAlias(options.cssPath)

@@ -27,26 +25,23 @@ module.exports = async function (moduleOptions) {
this.options.css.unshift(cssPath)
}

/*
** Set PostCSS config
** It has to be set before `nuxt-purgecss`
** only for `nuxt dev` and `nuxt build` commands
*/
if (isBuild) {
logger.info('postcss-preset-env stage is set to 1 for supporting advanced css features')
// This hooks is called only for `nuxt dev` and `nuxt build` commands
this.nuxt.hook('build:before', async () => {
/*
** Set PostCSS config (before nuxt-purgecss)
*/
this.options.build.postcss.preset.stage = 1 // see https://tailwindcss.com/docs/using-with-preprocessors#future-css-features
this.options.build.postcss.plugins = this.options.build.postcss.plugins || {}
this.options.build.postcss.plugins.tailwindcss = this.options.build.postcss.plugins.tailwindcss || configPath
}

/*
** Add nuxt-purgecss module and set config
** only for `nuxt build` command
*/
if (!this.options.dev && isBuild) {
const purgeCSS = { mode: 'postcss', ...(this.options.purgeCSS || {}) }
await this.requireModule(['nuxt-purgecss', purgeCSS])
}
/*
** Add nuxt-purgecss module and set config
** only for `nuxt build` command
*/
if (!this.options.dev) {
const purgeCSS = { mode: 'postcss', ...(this.options.purgeCSS || {}) }
await this.requireModule(['nuxt-purgecss', purgeCSS])
}
})
}

module.exports.meta = require('../package.json')
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ const { resolve } = require('path')
const { pathExists, copy } = require('fs-extra')
const logger = require('./logger')

async function ensureTemplateFile(srcDir, from, to) {
async function ensureTemplateFile (srcDir, from, to) {
const relativePath = to.replace(srcDir, '~')
const fileExists = await pathExists(to)

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxtjs/tailwindcss",
"version": "1.1.1",
"version": "1.1.2",
"description": "TailwindCSS module for Nuxt.js",
"license": "MIT",
"contributors": [
@@ -23,10 +23,10 @@
"lib"
],
"dependencies": {
"consola": "^2.9.0",
"consola": "^2.10.1",
"fs-extra": "^8.1.0",
"nuxt-purgecss": "^0.2.1",
"tailwindcss": "^1.0.5"
"tailwindcss": "^1.1.0"
},
"devDependencies": {
"@babel/core": "latest",
6 changes: 3 additions & 3 deletions test/config.test.js
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@ const { remove } = require('fs-extra')
const { Nuxt, Builder } = require('nuxt-edge')
const request = require('request-promise-native')
const getPort = require('get-port')
const config = require('../example/nuxt.config')
const logger = require('@/logger')

const config = require('../example/nuxt.config')
logger.mockTypes(() => jest.fn())

config.dev = false
config.tailwindcss = {
configPath: 'custom/tailwind.js',
@@ -19,8 +21,6 @@ let nuxt, port
const url = path => `http://localhost:${port}${path}`
const get = path => request(url(path))

logger.mockTypes(() => jest.fn())

describe('config', () => {
beforeAll(async () => {
nuxt = new Nuxt(config)
6 changes: 3 additions & 3 deletions test/fail.test.js
Original file line number Diff line number Diff line change
@@ -3,15 +3,15 @@ require('fs-extra').pathExists = jest.fn().mockImplementation(() => Promise.reso
require('fs-extra').copy = jest.fn().mockImplementation(() => Promise.reject(new Error('Error when copy')))

const { Nuxt, Builder } = require('nuxt-edge')
const config = require('../example/nuxt.config')
const logger = require('@/logger')

const config = require('../example/nuxt.config')
logger.mockTypes(() => jest.fn())

config.dev = false

let nuxt

logger.mockTypes(() => jest.fn())

describe('fail', () => {
beforeAll(async () => {
nuxt = new Nuxt(config)
8 changes: 3 additions & 5 deletions test/ok.test.js
Original file line number Diff line number Diff line change
@@ -4,19 +4,18 @@ const { join } = require('path')
const { Nuxt, Builder } = require('nuxt-edge')
const request = require('request-promise-native')
const getPort = require('get-port')
const config = require('../example/nuxt.config')
const logger = require('@/logger')

const config = require('../example/nuxt.config')
logger.mockTypes(() => jest.fn())

config.dev = false
config._build = true // imitate `nuxt build` comman

let nuxt, port

const url = path => `http://localhost:${port}${path}`
const get = path => request(url(path))

logger.mockTypes(() => jest.fn())

describe('ok', () => {
beforeAll(async () => {
nuxt = new Nuxt(config)
@@ -46,7 +45,6 @@ describe('ok', () => {
})

test('build', () => {
expect(logger.info).toHaveBeenCalledWith('postcss-preset-env stage is set to 1 for supporting advanced css features')
expect(nuxt.options.build.postcss.preset.stage).toBe(1)
expect(nuxt.options.build.postcss.plugins).toBeDefined()
expect(nuxt.options.build.postcss.plugins.tailwindcss).toBe(join(nuxt.options.srcDir, 'tailwind.config.js'))
Loading