我試圖在從Sass編譯時自動上傳.css
文件。這是我在Gruntfile.js
得:Grunt - 當文件被改變時觀察文件和SFTP
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
coffee: {
files: ['**/*.coffee'],
tasks: ['coffee']
},
scripts: {
files: ['**/*.scss'],
tasks: ['compass']
},
sftp: {
files: ['**/*.css'],
tasks: ['sftp-deploy']
}
},
coffee: {
compile: {
files: {
'testing.js': 'testing.coffee'
}
}
},
compass: {
dist: {
options: {
config: 'config.rb'
}
}
},
'sftp-deploy': {
build: {
auth: {
host: 'example.com',
port: 22,
authKey: 'key2'
},
src: 'styles/',
dest: 'styles/',
exclusions: ['**/.DS_Store'],
server_sep: '/'
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-sftp-deploy');
// Default task(s).
grunt.registerTask('default', ['watch']);
};
它編譯.css
但似乎並沒有把它上傳。有任何想法嗎?
'config.rb'輸出已編譯的'css'到什麼目錄? –
你不應該在本地執行此操作,然後只在運行構建步驟時才推送? –