Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy to GitHub Pages

on:
push:
branches: [main, master]

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Prepare Jekyll site
run: |
mkdir -p docs/css docs/js
cp dist/css/trackswitch.min.css docs/css/
cp dist/js/trackswitch.min.js docs/js/

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site

- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
7 changes: 0 additions & 7 deletions .gitlab-ci.yml

This file was deleted.

171 changes: 0 additions & 171 deletions Gruntfile.js

This file was deleted.

16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Citation

If you use this software in a scientific publication, please make sure to cite the following publication

Werner, Nils, et al. **"trackswitch.js: A Versatile Web-Based Audio Player for Presenting Scientifc Results."** 3rd web audio conference, London, UK. 2017.
Werner, Nils, et al. **"trackswitch.js: A Versatile Web-Based Audio Player for Presenting Scientific Results."** 3rd web audio conference, London, UK. 2017.

@inproceedings{werner2017trackswitchjs,
title={trackswitch.js: A Versatile Web-Based Audio Player for Presenting Scientifc Results},
title={trackswitch.js: A Versatile Web-Based Audio Player for Presenting Scientific Results},
author={Nils Werner and Stefan Balke and Fabian-Rober Stöter and Meinard Müller and Bernd Edler},
booktitle={3rd web audio conference, London, UK},
year={2017},
Expand All @@ -54,6 +54,14 @@ See [examples](https://audiolabs.github.io/trackswitch.js/examples.html).
Development
-----------

npm install -g grunt-cli
npm install
grunt serve
npm run build

This will compile Sass, concatenate files, and minify CSS/JS into the `dist/` folder.

### Build Scripts

- `npm run build` - Full build (clean, compile, minify)
- `npm run build:css` - Compile and minify CSS only
- `npm run build:js` - Concatenate and minify JS only
- `npm run clean` - Remove `dist/` folder
17 changes: 17 additions & 0 deletions build/concat-css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');

// Read CSS files in order
const reset = fs.readFileSync('dist/tmp/reset.css', 'utf8');
const trackswitch = fs.readFileSync('css/trackswitch.css', 'utf8');

// Create dist directory if needed
const distDir = path.dirname('dist/tmp/concat.css');
if (!fs.existsSync(distDir)) {
fs.mkdirSync(distDir, { recursive: true });
}

// Concatenate
fs.writeFileSync('dist/tmp/concat.css', reset + '\n' + trackswitch);
console.log('✓ Concatenated CSS');
46 changes: 46 additions & 0 deletions build/concat-js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const pkg = require('../package.json');

// Read package.json for banner
const banner = `/*!
* trackswitchjs v${pkg.version} (${pkg.homepage})
* Copyright ${new Date().getFullYear()} International Audio Laboratories Erlangen
* Licensed under MIT (https://github.com/audiolabs/trackswitchjs/blob/master/LICENSE)
*/
if (typeof jQuery === 'undefined') {
throw new Error('trackswitchjs\\'s JavaScript requires jQuery. jQuery must be included before trackswitchjs\\'s JavaScript.')
}
+function ($) {
var version = $.fn.jquery.split(' ')[0].split('.').map(Number)
if ((version[0] < 1) || (version[0] === 1 && version[1] < 9) || (version[0] === 1 && version[1] === 9 && version[2] < 1) || (version[0] >= 4)) {
throw new Error('trackswitchjs\\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0')
}
}(jQuery);
+function () {
`;

const footer = '\n}();';

// Read and process JS file
let js = fs.readFileSync('js/trackswitch.js', 'utf8');

// Remove export/import statements
js = js
.split('\n')
.filter(line => {
const trimmed = line.trim();
return !trimmed.startsWith('export ') && !trimmed.startsWith('import ');
})
.join('\n');

// Create dist directory if it doesn't exist
const distDir = path.dirname('dist/js/trackswitch.js');
if (!fs.existsSync(distDir)) {
fs.mkdirSync(distDir, { recursive: true });
}

// Write concatenated file with banner and footer
fs.writeFileSync('dist/js/trackswitch.js', banner + js + footer);
console.log('✓ Concatenated JS with banner and footer');
3 changes: 3 additions & 0 deletions docs/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'github-pages', group: :jekyll_plugins
3 changes: 3 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
theme: jekyll-theme-cayman
title: trackswitch.js
description: A Versatile Web-Based Audio Player for Presenting Scientific Results
Loading