Skip to content

Commit

Permalink
update structure, better support for es modules tailwind config
Browse files Browse the repository at this point in the history
  • Loading branch information
heidkaemper committed Jun 22, 2024
1 parent d0f6074 commit e474709
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion docs/example/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ module.exports = {
extend: {},
},
plugins: [
require('../../src/plugin.js')
require('../../src/plugin/index.cjs')
],
}
2 changes: 1 addition & 1 deletion jest/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function run(config, plugin = tailwindcss) {
const { currentTestName } = expect.getState()

config = {
plugins: [require('../src/plugin.js')],
plugins: [require('../src/plugin/index.cjs')],
corePlugins: { preflight: false },
...config,
}
Expand Down
16 changes: 1 addition & 15 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,12 @@ if (! fs.existsSync('./dist')) {
}

build({
entryPoints: ['src/observer.cdn.js'],
entryPoints: ['src/observer/cdn.js'],
outfile: 'dist/observer.min.js',
platform: 'browser',
define: { CDN: 'true' },
});

build({
entryPoints: ['src/observer.js'],
outfile: 'dist/observer.esm.js',
platform: 'neutral',
mainFields: ['main', 'module'],
});

build({
entryPoints: ['src/plugin.js'],
outfile: 'dist/plugin.js',
target: ['node10.4'],
platform: 'node',
});

function build(options) {
options.define || (options.define = {});

Expand Down
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import observer from './observer/index.js'
import intersect from './plugin.js'

export default observer
export { intersect }
3 changes: 0 additions & 3 deletions src/observer.cdn.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/observer/cdn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Observer from './index.js'

Observer.start()
File renamed without changes.
File renamed without changes.

0 comments on commit e474709

Please sign in to comment.