gpt4 book ai didi

sass - Grunt - 在文件和 SFTP 更改时观察它

转载 作者:行者123 更新时间:2023-12-04 12:41:41 25 4
gpt4 key购买 nike

我正在尝试自动上传 .css文件,当它从 Sass 编译时。这就是我的 Gruntfile.js 中的内容:

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但似乎没有上传它。有任何想法吗?

最佳答案

我想确认以下 grunt-ssh ( https://github.com/andrewrjones/grunt-ssh ) 任务配置对我来说工作正常。请注意, grunt 接受可能有助于调试的 --verbose 选项。请注意,从 v0.6.2 开始,grunt-ssh SFTP 任务似乎不支持 sshconfig 语法,这在帮助页面上不是很清楚。

    sftpCredentials: grunt.file.readJSON('sftp-credentials.json'),
sftp: {
deploy: {
files: {
"./": "deploy/**"
},
options: {
"path": "<%= sftpCredentials.path %>",
"host": "<%= sftpCredentials.host %>",
"username": "<%= sftpCredentials.username %>",
"port": "<%= sftpCredentials.port %>",
"password": "<%= sftpCredentials.password %>",
"srcBasePath": "deploy/",
"createDirectories": true
}
}
}

关于sass - Grunt - 在文件和 SFTP 更改时观察它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16878866/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com