Title: WP-LESS
Author: thom4
Published: <strong>2009 年 8 月 14 日</strong>
Last modified: 2025 年 5 月 14 日

---

搜尋外掛

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

![](https://s.w.org/plugins/geopattern-icon/wp-less.svg)

# WP-LESS

 由 [thom4](https://profiles.wordpress.org/oncletom/) 開發

[下載](https://downloads.wordpress.org/plugin/wp-less.1.9.8.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/wp-less/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/wp-less/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/wp-less/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/wp-less/#developers)

 [技術支援](https://wordpress.org/support/plugin/wp-less/)

## 外掛說明

[LESS](http://lesscss.org) is a templating language based on top of CSS. It provides
numerous enhancements to speed up development and make its maintenance easier.

Theme developers can even bundle the plugin without worrying about conflicts: just
include the special `bootstrap-for-theme.php` and read its instructions.

#### Features

 * Variables
 * Mixins (inheritance of rules)
 * Nested Rules (write less, do more)
 * Accessors (inherit a value from a specific rule)
 * Functions (logic operations for dynamic results)

The plugin lets you concentrate on what you need: coding CSS. Everything else is
handled automatically, from cache management to user delivery.
 Seriously.

#### Documentation

Advanced topics on how to use the plugin API are [available on the Github project documentation](https://github.com/oncletom/wp-less/tree/master/doc).

#### Requirements

The sole requirement is to use WordPress API and LESS convention: the `.less` extension.

**Minimal Requirements**: PHP 5.3 and WordPress 3.2.
 **Relies on**: [Less.php](http://lessphp.gpeasy.com/),
[plugin-toolkit](https://wordpress.org/extend/plugins/plugin-toolkit/).

_Notice_: in case you’d like to drop the usage of this plugin, it’s safe to do it.
You will just need to convert back your stylesheets to CSS.

## 螢幕擷圖

[⌊Sample of LESS to CSS conversion.⌉⌊Sample of LESS to CSS conversion.⌉[

Sample of LESS to CSS conversion.

## 安裝方式

#### Automatic

 1. Search for the plugin name (`WP-LESS`)
 2. Click on the install button
 3. Activate it

#### Manual

 1. Download the latest stable archive of the plugin
 2. Unzip it in your plugin folder (by default, `wp-content/plugins`)
 3. Activate it through your WordPress plugins administration page

## 常見問題集

Lots of efforts have been done to write a [consistent documentation](https://github.com/oncletom/wp-less/tree/master/doc)

to address issues you may encounter.

It covers topics like path customization, declaring LESS variables from PHP, creating
new LESS functions etc.

## 使用者評論

![](https://secure.gravatar.com/avatar/4421020034e4cc91742bf6fab4237e291698da45417c13e9e67b697d64e1a1b9?
s=60&d=retro&r=g)

### 󠀁[Very good](https://wordpress.org/support/topic/very-good-1825/)󠁿

 [marcrock](https://profiles.wordpress.org/marcrock/) 2017 年 1 月 15 日

Nice to work with it. Thank you very much!

![](https://secure.gravatar.com/avatar/cc8e31b8db49504b1ecf5ae1d13e017fcf4f0ab60bcf2332ebeb05dd73cef4a4?
s=60&d=retro&r=g)

### 󠀁[Well written and maintenance-free](https://wordpress.org/support/topic/well-written-and-maintenance-free/)󠁿

 [Makapaka](https://profiles.wordpress.org/makapaka/) 2016 年 9 月 3 日

This plugin is fast and error free. It allows to easly add Less support to your 
WP theme. No needed configuration, just treat your *.less files like regular *.css
in your theme’s directory.

![](https://secure.gravatar.com/avatar/8cd09c0df68d58750e849438cb5268d1751c2e70592e72f5fb32b9700b1ab039?
s=60&d=retro&r=g)

### 󠀁[Saves time for those Less experts](https://wordpress.org/support/topic/saves-time-for-those-less-experts/)󠁿

 [alvinkonda](https://profiles.wordpress.org/alvinkonda/) 2016 年 9 月 3 日

Thank you for this amazing plugin, it saves us Theme Developers lots of time with
this simple implementation directly from the theme. i love the passing of variables
as well. The only thing im not yet figuring it out is the CSS generated from the
plugin doent cache, am i missing sth?

![](https://secure.gravatar.com/avatar/c3919b8792d375e1011cbadd5c963cb1827671a22a3c54df477df20805eb4192?
s=60&d=retro&r=g)

### 󠀁[Works perfectly](https://wordpress.org/support/topic/works-perfectly-761/)󠁿

 [Marie-Aude](https://profiles.wordpress.org/marie-aude/) 2016 年 9 月 3 日

A wonderful tool to get rid of headers bloated with css. Thanks a lot.

 [ 閱讀全部 19 則使用者評論 ](https://wordpress.org/support/plugin/wp-less/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈WP-LESS〉的開發相關工作。

參與者

 *   [ thom4 ](https://profiles.wordpress.org/oncletom/)
 *   [ fabrizim ](https://profiles.wordpress.org/fabrizim/)

〈WP-LESS〉外掛目前已有 1 個本地化語言版本。 感謝[全部譯者](https://translate.wordpress.org/projects/wp-plugins/wp-less/contributors)
為這個外掛做出的貢獻。

[將〈WP-LESS〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/wp-less)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/wp-less/)、查看
[SVN 存放庫](https://plugins.svn.wordpress.org/wp-less/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/wp-less/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/wp-less/)。

## 變更記錄

#### Version 1.9.0

 * feature: default less compiler is now [wikimedia/less.php](https://github.com/wikimedia/less.php)(
   [#117](https://github.com/oncletom/wp-less/pull/117))
 * feature: output is compressed by default

#### Version 1.8.0

 * feature: default less compiler is now [oyejorge/less.php](http://lessphp.gpeasy.com/)(
   [#90](https://github.com/oncletom/wp-less/pull/90)

#### Version 1.7.6

 * info: updated vendored lessphp libraries versions (oyejorge/less.php@1.7.0.5)

#### Version 1.7.5

 * feature: now works properly in the admin side ([#68](https://github.com/oncletom/wp-less/pull/68))

#### Version 1.7.4

 * feature: favour composer autoload to manual PHP `require` ([#64](https://github.com/oncletom/wp-less/pull/64))

#### Version 1.7.3

 * bug: fixed the LESS library loading ([#63](https://github.com/oncletom/wp-less/issues/63))
 * doc: documented the new LESS library swapping

#### Version 1.7.0

 * feature: ability to provide your own flavour of `lessphp` or `less.php` ([#53](https://github.com/oncletom/wp-less/pull/53))
 * bug: fixed stylesheet directory computation ([#61](https://github.com/oncletom/wp-less/pull/61))
 * bug: unlink exception during utpdated files cleanup ([#49](https://github.com/oncletom/wp-less/pull/49))
 * style: code cleanup ([#56](https://github.com/oncletom/wp-less/pull/56), [#55](https://github.com/oncletom/wp-less/pull/55))

#### Version 1.6.0

Read the UPGRADE NOTICE carefully as this release contains BC change. Hence the 
version bump to `1.6.0`.

 * lessphp: updated to v0.4.0

#### Version 1.5.4

 * bug: fixed stylesheet URL computation ([#38](https://github.com/oncletom/wp-less/pull/38))
 * bug: fixed cache-hit miss after stylesheet garbage collection ([#40](https://github.com/oncletom/wp-less/pull/40))
 * added a CONTRIBUTORS file

#### Version 1.5.3

 * lessphp: updated to v0.3.9

#### Version 1.5.2

 * bug: fixed garbage collector bug ([#28](https://github.com/oncletom/wp-less/pull/28))
 * bug: fixed cachebusting URI generation in deep mode ([#29](https://github.com/oncletom/wp-less/pull/29))
 * bug: fixed access to Plugin instance, matching the documentation ([#39](https://github.com/oncletom/wp-less/pull/39))

#### Version 1.5.1

 * feature(beta): less stylesheets can be enqueued in `wp-admin`
 * feature: added `WPLessConfiguration::getTtl` method to let you configure the 
   delay of old-files cleanup
 * bug: fixed automatic replacements with absolute and data uri ([#19](https://github.com/oncletom/wp-less/pull/19))
 * bug: fixed garbage collector; was pruning active stylesheets even if too old (
   buggy with active cache) ([#20](https://github.com/oncletom/wp-less/pull/20))

#### Version 1.5

Mostly issues related to `lessphp` 0.3.8 features.

 * /!\ Leveraged PHP Minimum Version to 5.2.4 /!\ ([WordPress already asks you the same](https://wordpress.org/about/requirements/))
 * [dev documentation available online](https://github.com/oncletom/wp-less/tree/master/doc)
 * bug: stylesheets compilation is now processed on `wp_enqueue_scripts` ([prop of @RixTox](https://github.com/oncletom/wp-less/pull/18))
 * feature: providing stylesheet and template directory uri variables (`@stylesheet_directory_uri`&`@
   template_directory_uri`) following WordPress convention
 * feature: Pruning old compiled files [#15](https://github.com/oncletom/wp-less/pull/15)
 * feature: Smarter LESS compilation (following @import file updates) [#13](https://github.com/oncletom/wp-less/pull/13)
 * feature: Systematic LESS rebuild through configuration [#14](https://github.com/oncletom/wp-less/pull/14)
 * improvement: Match lessphp variable API [#12](https://github.com/oncletom/wp-less/pull/12)

#### Version 1.4.3

 * bug: fixed HTTPS/Networked Blog URL replacement ([#8](https://github.com/oncletom/wp-less/pull/8),
   [#9](https://github.com/oncletom/wp-less/pull/9))
 * bug: fixed the `property of non-object in Plugin.class.php` bug
 * lessphp: updated to 0.3.8 (compatible with lessjs 1.3)

#### Version 1.4.2

 * feature: if `WP_DEBUG` is set to true, compilation is done on every page
 * feature: rebuild now takes care of LESS PHP variable
 * feature: added support of [custom LESS functions](http://leafo.net/lessphp/docs/index.html#custom_functions)
 * lessphp: updated to version 0.3.1

#### Version 1.4.1

 * bug: CSS `url()` are now properly resolved relative to the theme URL

#### Version 1.4

 * action: `wp-less_compiler_parse_pre` now takes 3 arguments: class instance, text
   and variable arguments
 * action: `wp-less_stylesheet_save_pre` now takes 2 arguments: class instance and
   variable arguments
 * helper: added `less_add_variable` to ease manipulations from theme, if needed(
   the file needs to be included manually)
 * stylesheet: `getBuffer()` and `setBuffer` will be removed in 1.5 version
 * lessphp: removed the custom patch for buffer manipulation, due to built-in variable
   management
 * lessphp: updated to version 0.3.0

#### Version 1.3.1

 * renamed `wp-less_compiler_parse` action to `wp-less_compiler_parse_pre` to avoid
   name conflicts
 * renamed `wp-less_compiler_construct` action to `wp-less_compiler_construct_pre`
   to avoid name conflicts
 * lessphp: patched the lib to let manipulating the buffer, and replace strings (
   do it at your own risks)

#### Version 1.3

 * moved stylesheet processing from `wp_print_styles` to `wp` action
 * added new compiler actions and filters (same name each): `wp-less_compiler_construct`
   and `wp-less_compiler_parse`
 * added `WPLessCompiler::getBuffer()` and `WPLessCompiler::setBuffer()` method,
   to enables hooking on LESS content, before being compiled into CSS
 * removed `WPLessStyleseet::getTargetContent` method
 * upgraded `plugin-toolkit`
 * usage of `$WPLessPlugin->dispatch` instead of `$WPLessPlugin->registerHooks` 
   to match the new `plugin-toolkit` signature
 * no more configuration collision if usage of multiple plugins using `plugin-toolkit`
 * lessphp: updated to [eac64a9d5a3bc3186a11c7130968388819f4c403](https://github.com/leafo/lessphp/commit/eac64a9d5a3bc3186a11c7130968388819f4c403)
   commit

#### Version 1.2.1

 * fixed the case where no stylesheet is queued (no warning anymore)

#### Version 1.2

 * added 2 new filters working on freshly transformed CSS
 * added a HTML helper to LESSify directly from templates, without queuying with`
   wp_enqueue_stylesheet` (can’t really recommend this usage)
 * added timestamp calculation so as you can be HTTP cache-control compliant
 * documented plugin hooks and filters
 * hooked a filter to update relative paths to deal `uri` and cached file location
 * lessphp: updated to version 0.2.0

#### Version 1.1

 * added `bootstrap-for-theme.php` to let themers bundle the plugin in their own
   themes
 * added `WPLessPlugin::registerHooks` methods to ease hooks activation
 * theme bootstrap will only load if the plugin is not alread activated
 * `WPLessPlugin::processStylesheets()` and `WPLessPlugin::processStylesheet()` 
   now accepts an additional parameter to force the rebuild
 * lessphp: updated to version 0.1.6
 * plugin-toolkit: updated to version 1.1

#### Version 1.0

 * implemented API to let you control the plugin the way you want
 * just in time compilation with static file caching
 * lessphp: bundled to version 0.1.6
 * plugin-toolkit: bundled experimental plugin development

## 中繼資料

 *  版本 **1.9.8**
 *  最後更新 **1 年前**
 *  啟用安裝數 **10,000+**
 *  WordPress 版本需求 ** 3.2 或更新版本 **
 *  已測試相容的 WordPress 版本 **5.8.13**
 *  語言
 * [English (US)](https://wordpress.org/plugins/wp-less/) 及 [Swedish](https://sv.wordpress.org/plugins/wp-less/).
 *  [將這個外掛本地化為你的母語版本](https://translate.wordpress.org/projects/wp-plugins/wp-less)
 * 標籤:
 * [lesscss](https://tw.wordpress.org/plugins/tags/lesscss/)[styles](https://tw.wordpress.org/plugins/tags/styles/)
   [stylesheet](https://tw.wordpress.org/plugins/tags/stylesheet/)[toolkit](https://tw.wordpress.org/plugins/tags/toolkit/)
 *  [進階檢視](https://tw.wordpress.org/plugins/wp-less/advanced/)

## 評分

 4.6 星，滿分為 5 星

 *  [  16 個 5 星使用者評論     ](https://wordpress.org/support/plugin/wp-less/reviews/?filter=5)
 *  [  1 個 4 星使用者評論     ](https://wordpress.org/support/plugin/wp-less/reviews/?filter=4)
 *  [  1 個 3 星使用者評論     ](https://wordpress.org/support/plugin/wp-less/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/wp-less/reviews/?filter=2)
 *  [  1 個 1 星使用者評論     ](https://wordpress.org/support/plugin/wp-less/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/wp-less/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/wp-less/reviews/)

## 參與者

 *   [ thom4 ](https://profiles.wordpress.org/oncletom/)
 *   [ fabrizim ](https://profiles.wordpress.org/fabrizim/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/wp-less/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=752034)