diff --git a/core/js/index.js b/core/js/index.js index 2c5bf376..7102eb2e 100644 --- a/core/js/index.js +++ b/core/js/index.js @@ -4,11 +4,10 @@ import './prototype-nav'; import './styleguide-code-samples'; import './styleguide-typography'; import './styleguide-search'; +import rememberScroll from './styleguide-remember-scroll'; window.$ = $; -const rememberScroll = require('./styleguide-remember-scroll'); - rememberScroll('#__prototype-nav'); rememberScroll('.br-styleguide-content'); rememberScroll('.br-styleguide-navigation-holder'); diff --git a/core/js/prototype-nav.js b/core/js/prototype-nav.js index 2ae4fe33..bd63389f 100644 --- a/core/js/prototype-nav.js +++ b/core/js/prototype-nav.js @@ -1,6 +1,7 @@ -const $ = require('jquery'); -const packageJson = require('../../package.json'); -const config = require('../discovery/config'); +import $ from 'jquery'; + +import packageJson from '../../package.json'; +import config from '../discovery/config'; const ACTIVATION_KEYCODE = 77; // 'M' key or 'B' key for Windows const ACTIVATION_KEYCODE_WINDOWS = 66; // 'M' key or 'B' key for Windows diff --git a/core/js/styleguide-code-samples.js b/core/js/styleguide-code-samples.js index ef0d8a61..ff29b41e 100644 --- a/core/js/styleguide-code-samples.js +++ b/core/js/styleguide-code-samples.js @@ -1,10 +1,10 @@ -const $ = require('jquery'); -const Clipboard = require('clipboard'); -const Codemirror = require('codemirror'); -const config = require('../discovery/config'); -//require('codemirror/mode/javascript/javascript'); -require('codemirror/mode/pug/pug'); -require('codemirror/mode/xml/xml'); +import $ from 'jquery'; +import Clipboard from 'clipboard'; +import Codemirror from 'codemirror'; +import 'codemirror/mode/pug/pug'; +import 'codemirror/mode/xml/xml'; + +import config from '../discovery/config'; const $codeHolders = $('.br-sample-code'); const $codeBlocks = $('.br-sample-markup'); diff --git a/core/js/styleguide-remember-scroll.js b/core/js/styleguide-remember-scroll.js index 7dec4dbc..3bdeac8b 100644 --- a/core/js/styleguide-remember-scroll.js +++ b/core/js/styleguide-remember-scroll.js @@ -15,11 +15,6 @@ for (var selector in scrollPositions) { $(selector).scrollTop(+scrollPositions[selector]); } -// Export function to store selector in map -module.exports = function (selector) { - scrollPositions[selector] = $(selector).scrollTop() || 0; -}; - // Save positions on unload window.onbeforeunload = function () { for (var selector in scrollPositions) { @@ -27,3 +22,7 @@ window.onbeforeunload = function () { } sessionStorage.setItem(SCROLL_STORAGE_KEY, JSON.stringify(scrollPositions)); }; + +export default function (selector) { + scrollPositions[selector] = $(selector).scrollTop() || 0; +} diff --git a/core/js/styleguide-search.js b/core/js/styleguide-search.js index 078cd9df..fc605f7c 100644 --- a/core/js/styleguide-search.js +++ b/core/js/styleguide-search.js @@ -1,4 +1,4 @@ -const $ = require('jquery'); +import $ from 'jquery'; $('#styleguideSearch').on('input', function(e) { diff --git a/core/js/styleguide-typography.js b/core/js/styleguide-typography.js index 74a40583..5617d2fa 100644 --- a/core/js/styleguide-typography.js +++ b/core/js/styleguide-typography.js @@ -1,4 +1,4 @@ -const $ = require('jquery'); +import $ from 'jquery'; const $typographyEntries = $('#component-typography tbody tr'); @@ -17,4 +17,4 @@ on_resize(function() { calculateFontSizes(); }); -calculateFontSizes(); \ No newline at end of file +calculateFontSizes();