Je surveille un dossier de thème dans un projet WordPress pour regarder les fichiers .scss et les exécuter à l'aide de l'outil sass de la ligne de commande pour créer des fichiers .css propres.Erreur lors de l'utilisation de FSSM pour surveiller les fichiers SASS
Le script fonctionne dans la mesure où la conversion l'empêche de fournir une sortie car il reçoit une «erreur de rappel FSSM». Quelqu'un peut-il me dire pourquoi cela arrive?
#sudo gem install fssm
#sudo gem install haml
# Script to watch a directory for any changes to an scss file and compile it to css in the same place
#
# USAGE: ruby sassy.rb <directory_to_watch>
#
require 'rubygems'
require 'fssm'
#directory = File.join(File.dirname(__FILE__), ARGV.first)
directory = "../wp-content/themes/"
FSSM.monitor(directory, '**/*.scss') do
update do |base, relative|
input = "#{base}/#{relative}"
output = "#{base}/#{relative.gsub!('.scss', '.css')}"
command = "sass --scss --watch #{input}:#{output}"
%x{#{command}}
puts "SASSy regenerated #{input} to #{output}"
end
end
Comme je l'ai dit le SCSS est compilé dans un fichier .css dans le même répertoire, mais l'erreur est:
sy-mbp:_build simon$ ruby sassy.rb
^Csassy.rb:19:in ``': update - /Data/code/eil/wp-content/themes/eil-baseline/style.scss: (FSSM::CallbackError)
from sassy.rb:19
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/path.rb:73:in `call'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/path.rb:73:in `run_callback'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/path.rb:55:in `callback_action'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/path.rb:35:in `update'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/state/directory.rb:38:in `modified'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/state/directory.rb:36:in `each'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/state/directory.rb:36:in `modified'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/state/directory.rb:17:in `refresh'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/backends/fsevents.rb:15:in `add_handler'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/backends/fsevents.rb:14:in `each'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/backends/fsevents.rb:14:in `add_handler'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/backends/rubycocoa/fsevents.rb:107:in `call'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/backends/rubycocoa/fsevents.rb:107:in `initialize'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/backends/fsevents.rb:27:in `call'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/backends/fsevents.rb:27:in `CFRunLoopRun'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/backends/fsevents.rb:27:in `run'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm/monitor.rb:20:in `run'
from /Library/Ruby/Gems/1.8/gems/fssm-0.2.3/lib/fssm.rb:18:in `monitor'
from sassy.rb:12
aide grandement appréciée!
Simon
Merci beaucoup Caius! – simonyoung