Mocha is a unittest framework for Node. In this document, we explain how you can test your javascript code and also your HTTP servers.
Use npm to install Mocha:
npm install mocha| 1) header и footer перемещаем в отдельные файлы header.php и footer.php | |
| на их местах в index.php вставляем команды: | |
| <?php get_header();?> // подключаем header | |
| <?php get_footer();?> // подкючаем footer | |
| 2) в header.php после всех стилей добавляем функцию <?php wp_head();?>. В footer.php после всех скриптов добавляем <?php wp_footer();?> | |
| 3) ко всем локальным путям добавляем функцию по образцу: | |
| <link rel="stylesheet" href="<?php echo get_template_directory_uri();?>/css/main.css"> | |
| <script src="<?php echo get_template_directory_uri();?>/js/main.js"></script> | |
| <img src="<?php echo get_template_directory_uri();?>/img/photo.jpg" alt="my-photo"> | |
| 4) удалить admin bar. В файл functions.php добавить: |
| var gulp = require('gulp'), | |
| sass = require('gulp-ruby-sass'), | |
| autoprefixer = require('gulp-autoprefixer'), | |
| minifycss = require('gulp-minify-css'), | |
| jshint = require('gulp-jshint'), | |
| uglify = require('gulp-uglify'), | |
| rename = require('gulp-rename'), | |
| clean = require('gulp-clean'), | |
| concat = require('gulp-concat'), | |
| notify = require('gulp-notify'), |
| <?php | |
| $custom_fields = get_post_custom($post->ID); | |
| foreach ( $custom_fields as $field_key => $field_values ) { | |
| if(!isset($field_values[0])) continue; | |
| if(in_array($field_key,array("_edit_lock", "_edit_last", "_thumbnail_id"))) continue; | |
| echo "<strong>$field_key:</strong> $field_values[0] <br>"; | |
| } |
| sass/ | |
| | | |
| |– base/ | |
| | |– _reset.scss # Reset/normalize | |
| | |– _typography.scss # Typography rules | |
| | ... # Etc… | |
| | | |
| |– components/ | |
| | |– _buttons.scss # Buttons | |
| | |– _carousel.scss # Carousel |
| /*========== Desktop First Method ==========*/ | |
| /* Large Devices, Wide Screens */ | |
| @media only screen and (max-width : 1200px) { | |
| } | |
| /* Medium Devices, Desktops */ | |
| @media only screen and (max-width : 992px) { |
| <style> | |
| /* ---------------------------------------------- /* | |
| * Mouse animate icon | |
| /* ---------------------------------------------- */ | |
| .mouse-icon { | |
| border: 2px solid #000; | |
| border-radius: 16px; | |
| height: 40px; | |
| width: 24px; | |
| display: block; |
Mocha is a unittest framework for Node. In this document, we explain how you can test your javascript code and also your HTTP servers.
Use npm to install Mocha:
npm install mocha| <?php $url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large' ); $url = $url['0']; ?> |
| $("img").on("dragstart", function(event) { event.preventDefault(); }); |