Giter Site home page Giter Site logo

gulp-wordress-starter's Introduction

Gulp Wordpress Starter

Gulp сборка разработанная для разработки wordpress тем локально. Основная функция сборки это автоматичское обновление css на сайте при сохранении css файлов. При этом страница не перегружается и результат видно сразу же. Так же доступна верся для scss. Смотрите ветку scss

При изменении .php файлов страница перегружается полностью.

Использование

Добавьте файлы к теме

Поместите содержимое репозитория в папку с темой wordpress. Убедитесь что не будет конфликтов имен и директорий.

Отключите кеширование

Для отключение кеширования при разработке подключите стили и скрипты даным способом:

// Css Styles
if (!is_admin()) {
	$theme = wp_get_theme(); // Used for cache busting
	wp_enqueue_style('Style', get_template_directory_uri() . '/dist/styles.css', array(), $theme->get('Version'), 'all');
} else {
	wp_enqueue_style('Style', get_template_directory_uri() . '/dist/styles.css');
}
// JS Scripts
if (!is_admin()) {
	$theme = wp_get_theme(); // Used for cache busting
	wp_enqueue_script('m1_template-scripts', get_template_directory_uri() . '/dist/scripts.js', array(), $theme->get('Version'), 'all');
} else {
	wp_enqueue_script( 'm1_template-scripts', get_template_directory_uri() . '/dist/scripts.js');
}

Найстройте gulpfile.js

Обезательно замените localhost.wp в вашем gulpfile.js на ваш локальный домен

Запуск сборки

Дальше установите все пакеты npm и запускайте зборку

npm install
npm gulp

Файловая структура

theme_folder
-css
--libs-css.css
--main.css
--_media.css
-js
--libs-js.js
--common.js
-dist - тут будут содержатся файлы после запуска сборки
--style.css
--scripts.js


// Также файлы сборки для gulp:
package.js
package-lock.js
gulpfile.js

gulp-wordress-starter's People

Contributors

dependabot[bot] avatar michaelgitart avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.