Objective get bit components to play nice with next js
npx create-next-app@latestor with typescriptnpx create-next-app@latest --tsyarn add sassyarn add next-transpile-modules
- I was unable to import bit.cloud modules into next.js
npx create-next-app@latest or with typescript npx create-next-app@latest --tsyarn add sassyarn add next-transpile-modules| var url = "https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/js/swiper.min.js"; | |
| function require( url ) { | |
| var ajax = new XMLHttpRequest(); | |
| ajax.open( 'GET', url, false ); // <-- the 'false' makes it synchronous | |
| ajax.onreadystatechange = function () { | |
| var script = ajax.response || ajax.responseText; | |
| if (ajax.readyState === 4) { | |
| switch( ajax.status) { |
| def get_last_modified(dir) | |
| # make sure the files to be checked are in the provided directory | |
| files = Dir.new(dir).select { |file| file!= '.' && file!='..' } | |
| # make sure the file has been written to | |
| return nil if (files.size < 1) | |
| # create an array of all the files | |
| files = files.collect { |file| File.join(dir , file) } |
| /** | |
| * Preprocess html; | |
| * add page-pagname classes to the body element | |
| */ | |
| function hook_preprocess_html(&$vars) { | |
| $vars['attributes_array']['class'][] = $vars['classes_array'][] = 'page-' . drupal_html_class(drupal_get_title()); | |
| } |
| function get_video_thumb(url, callback){ | |
| var id = get_video_id(url); | |
| if (id['type'] == 'y') { | |
| return processYouTube(id); | |
| } else if (id['type'] == 'v') { | |
| $.ajax({ | |
| url: 'http://vimeo.com/api/v2/video/' + id['id'] + '.json', | |
| dataType: 'jsonp', | |
| success: function(data) { |
| /* ------------------------------------------------- | |
| ** FANCYBOX CLEANUP & OVERIDES | |
| ** ---------------------------------------------- */ | |
| .fancybox-overlay, .fancybox-overlay *, #fancybox-thumbs, #fancybox-thumbs * { | |
| @include box-sizing('content-box'); | |
| } | |
| .fancybox-wrap, .fancybox-wrap * { | |
| @include box-sizing('content-box'); |
| <?php | |
| global $post; | |
| $post_backup = $post; | |
| $args = array( | |
| 'posts_per_page' => -1, | |
| 'post_type' => 'post-type-news', | |
| 'orderby' => 'date', | |
| 'order' => 'DSC' | |
| ); |