Skip to content

Commit

Permalink
Remove dist.lite directory
Browse files Browse the repository at this point in the history
Plus other cleanup from review.
  • Loading branch information
egirard committed Jun 20, 2024
1 parent 0a62254 commit 774b9b8
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 65 deletions.
12 changes: 0 additions & 12 deletions src/index-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {
ScrollTimeline,
ViewTimeline,
} from "./scroll-timeline-base";
import {
animate,
elementGetAnimations,
documentGetAnimations,
ProxyAnimation
} from "./proxy-animation.js";


import { initPolyfill } from "./init-polyfill.js"

initPolyfill();
2 changes: 1 addition & 1 deletion src/init-polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { initCSSPolyfill } from "./scroll-timeline-css"

export function initPolyfill() {
// Don't load if browser claims support
if (CSS.supports("view-timeline")) {
if (window.ViewTimeline !== undefined) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/scroll-timeline-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function updateKeyframesIfNecessary(anim, options) {

export function initCSSPolyfill() {
// Don't load if browser claims support
if (CSS.supports("view-timeline")) {
if (CSS.supports("animation-timeline: --works")) {
return true;
}

Expand Down
28 changes: 28 additions & 0 deletions vite.config.common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export function buildConfig(source, filename) {
return {
build: {
sourcemap: true,
emptyOutDir: false,
lib: {
// Could also be a dictionary or array of multiple entry points
entry: source,
name: 'ScrollTimeline',
// the proper extensions will be added
fileName: (format, entryAlias) => `${filename}${format=='iife'?'':'-' + format}.js`,
formats: ['iife'],
},
minify: 'terser',
terserOptions: {
keep_classnames: /^((View|Scroll)Timeline)|CSS.*$/
},
rollupOptions: {
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
},
},
}
}
};
}
27 changes: 2 additions & 25 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
import { resolve } from 'path'
import { defineConfig } from 'vite'
import { buildConfig } from './vite.config.common'

export default defineConfig({
build: {
sourcemap: true,
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'src/index.js'),
name: 'ScrollTimeline',
// the proper extensions will be added
fileName: (format, entryAlias) => `scroll-timeline${format=='iife'?'':'-' + format}.js`,
formats: ['iife'],
},
minify: 'terser',
terserOptions: {
keep_classnames: /^((View|Scroll)Timeline)|CSS.*$/
},
rollupOptions: {
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
},
},
}
},
})
export default defineConfig(buildConfig(resolve(__dirname, 'src/index.js'), 'scroll-timeline'));
28 changes: 2 additions & 26 deletions vite.config.lite.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
import { resolve } from 'path'
import { defineConfig } from 'vite'
import { buildConfig } from './vite.config.common'

export default defineConfig({
build: {
sourcemap: true,
outDir: 'dist-lite',
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'src/index-lite.js'),
name: 'ScrollTimelineLite',
// the proper extensions will be added
fileName: (format, entryAlias) => `scroll-timeline-lite${format=='iife'?'':'-' + format}.js`,
formats: ['iife'],
},
minify: 'terser',
terserOptions: {
keep_classnames: /^((View|Scroll)Timeline)|CSS.*$/
},
rollupOptions: {
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
},
},
}
},
})
export default defineConfig(buildConfig(resolve(__dirname, 'src/index-lite.js'), 'scroll-timeline-lite'));

0 comments on commit 774b9b8

Please sign in to comment.