Skip to content

Commit

Permalink
pack scroll-timeline polyfill into ngx-scrollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Smarthard committed Apr 8, 2024
1 parent c0ea0d9 commit 6505bab
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion projects/ngx-scrollbar-demo/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ export function app(): express.Express {
const server = express();
const serverDistFolder = dirname(fileURLToPath(import.meta.url));
const browserDistFolder = resolve(serverDistFolder, '../browser');
const scrollbarPolyfill = resolve(serverDistFolder, '../../ngx-scrollbar/assets/scroll-timeline-polyfill.js');
const indexHtml = join(serverDistFolder, 'index.server.html');

const commonEngine = new CommonEngine();

server.set('view engine', 'html');
server.set('views', browserDistFolder);

server.use('/assets/scroll-timeline-polyfill.js', (_, res) => res.sendFile(scrollbarPolyfill));

// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('*.*', express.static(browserDistFolder, {
server.use(express.static(browserDistFolder, {
maxAge: '1y'
}));

Expand Down
7 changes: 7 additions & 0 deletions projects/ngx-scrollbar/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/ngx-scrollbar",
"assets": [
{
"glob": "*",
"input": "./src/assets/",
"output": "assets"
}
],
"lib": {
"entryFile": "src/public-api.ts"
}
Expand Down
2 changes: 2 additions & 0 deletions projects/ngx-scrollbar/src/assets/scroll-timeline-polyfill.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion projects/ngx-scrollbar/src/lib/utils/scrollbar-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DOCUMENT, isPlatformBrowser } from '@angular/common';
import { NG_SCROLLBAR_POLYFILL } from '../ng-scrollbar.model';
import { ScrollTimelineFunc } from './common';

const scrollTimelinePolyfillUrl: string = 'https://flackr.github.io/scroll-timeline/dist/scroll-timeline.js';
const scrollTimelinePolyfillUrl: string = 'assets/scroll-timeline-polyfill.js';

@Injectable({ providedIn: 'root' })
export class ScrollbarManager {
Expand Down

0 comments on commit 6505bab

Please sign in to comment.