- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在服务器(非本地)上开发 WordPress 站点。每当我修改 sass 文件时,我都想刷新浏览器中的页面。我列出了一些繁重的任务,但现在我只想在任何 sass 修改时刷新它。现在,每当修改文件时它都会捕获,但不会刷新页面。
咕噜文件:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
scripts: {
options: { livereload: true },
files: ['**/*.scss'],
//tasks: ['criticalcss:front', 'criticalcss:page', 'cssmin', 'postcss'],
}
},
postcss: {
options: {
processors: [
require('autoprefixer')({browsers: 'last 6 versions'}), // add vendor prefixes
//require('cssnano')() // minify the result
]
},
dist: {
src: 'style.css',
dest: 'style.css'
}
},
criticalcss: {
front : {
options: {
url: "https://grandeurflooring.ca/grand_dev/",
minify: true,
width: 1500,
height: 900,
outputfile: "critical_css/critical-front.css",
filename: "style.css",
buffer: 800*1024,
ignoreConsole: true
}
},
page : {
options: {
url: "https://grandeurflooring.ca/grand_dev/sample-page/",
minify: true,
width: 1500,
height: 900,
outputfile: "critical_css/critical-page.css",
filename: "style.css",
buffer: 800*1024,
ignoreConsole: true
}
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'critical_css',
src: ['*.css', '!*.min.css'],
dest: 'critical_css',
ext: '.min.css'
}]
}
}
});
// Load the plugin that provides the "critical" task.
grunt.loadNpmTasks('grunt-criticalcss');
// Load the plugin that provides the "cssmin" task.
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Load the plugin that provides the "watch" task.
grunt.loadNpmTasks('grunt-contrib-watch');
// Load the plugin that provides the "PostCSS" task.
grunt.loadNpmTasks('grunt-postcss');
// Critical task.
grunt.registerTask('critical', ['criticalcss:front']);
};
<script src="http://localhost:35729/livereload.js"></script>
最佳答案
您可以配置 Grunt 来查看您 dist
中编译的 css 文件。目录,每次重新编译 Sass 时都会更新该目录。
这是我的 watch
实现您想要的配置:
watch: {
options: {
livereload: true,
},
html: {
files: ['index.html'],
},
js: {
files: ['js/**/*.js'],
tasks: ['jshint'],
},
sass: {
options: {
livereload: false
},
files: ['css/scss/**/*.scss'],
tasks: ['sass'],
},
css: {
files: ['dist/css/master.css'],
tasks: []
}
}
spawn: false
至
spawn: true
也取决于您的设置。
Run predefined tasks whenever watched file patterns are added, changed or deleted
关于gruntjs - Grunt 在服务器上现场观看 LiveReload,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43808127/
我刚接触一个项目,开发人员仍然通过邮件发送文件来共享代码。我们正在使用 eclipse 和 cvs。 场外的开发人员将代码发送到现场进行审核,其他开发人员从那里的邮件中一一获取文件并在 Eclipse
我完成了 session 站点设计,现在应该创建数据库。但我不确定该使用哪种方法。我正在使用 Apache、PHP 和 MySQL。我有用户,每个用户都有输入和输出邮箱,每个用户都有一个好友列表。这是
我们的开发团队刚刚将一个应用程序从本地服务器迁移到实时站点。该应用程序利用可写入的远程数据库,并利用 MSQLi 和 PDO 方法获取数据并将数据推送到数据库。 更新 connect .inc 文件以
大家好,我想使用 java 连接到我网站上的数据库。我想知道我应该在 URL 中输入什么: cnt=DriverManager.getConnection(DB_URL, DB_UID,DB_PWD)
我不确定“硬失败”是否是正确的词,但这是我面临的问题。我花了相当长的时间来重现这个尽可能最小的例子,所以它是这样的: class BaseParameterizedType fun > getSpec
我希望有人能够帮助解决我遇到的问题。下面的代码管理我正在开发的网站上的音频播放器。这个想法是,用户可以单击静音按钮来切换网站上的声音,如果用户单击特定链接离开网站,则声音应该被静音(如果尚未静音)。
我在站点中使用 libcurl 进行身份验证。我用它制作了很多功能,例如: char *CheckLoginPass(char *login, char *pass) { //use curl_e
我正在创建一个社交媒体风格的网站,并使用 Meteor 和 MongoDB 创建帖子,其中包含 {{title}} 和 {{content}}一个 Accordion 菜单,标题在菜单的标题上,内容在
我昨天为一个网站写了一个小的桌面 package 器(它实际上只是加载一个网站),作为对 Electron 的一些练习,但我注意到以下事情: 通常应该(并且确实)在每个浏览器上工作的 Javascri
我的应用程序中有 WebView 。我可以在 IDE 中看到警告。“使用 setJavaScriptEnabled 会引入 XSS 漏洞”代码 webView.getSettings().setJav
我正在做一个多步骤表单,所有内容都在最后保存。在我的模型中,我有一个 m2m 复选框字段,并且我使用 django Sessions 来获取表单数据以在最后一步中显示它。 问题是当我提交最终表单时,m
我们已经实现了 WURFL 现场 Java 应用程序(使用 maven/servlet 实现的 berryapp),我们将其用于所有 Java 应用程序,只需在所有其他应用程序中调用该应用程序即可。由
我是一名优秀的程序员,十分优秀!