随附的js / css文件的编号是多少?

时间:2018-10-26 18:13:39

标签: javascript html css frontend

我试图了解为什么网站对css和js文件执行以下操作-或是否/为什么我想这样做。

// service.ts
import { Subject } from 'rxjs';

doUpdate(bar: thing): Promise<thing> {
  foo = new Subject<any>();

  this.http.post(`${environment.API_URL}rules/create`, rule).subscribe((response: any) => {
  this.pwsNotificationService.add({
    type: 'success',
    msg: `Rule Created!`,
    timeout: 5000
  });
  rule.reset();
  form.reset();
  foo.complete();
}, () => {
  this.pwsNotificationService.add({
    type: 'danger',
    msg: `POST Request Failed. Please contact the Data Monitoring Team.`,
    timeout: 5000
  });

  foo.complete();
}


  return foo.toPromise();
}


// whatever calls the service method doUpdate
this.service.doUpdate(formthing).then(
     (result)=>{
          // call service for get, or do processing or whatever
          // if this function returns a promise you can add more .then()
     }
); // further thens would go here

这些自动生成的数字是否仅用于版本控制?还是有一些与安全性相关的原因要添加这些?

当您更新CSS库时,必须进入并进行更新对我来说似乎比较脆弱。而且比使用实际的版本号更令人讨厌。

2 个答案:

答案 0 :(得分:0)

我认为它用于消除从缓存加载过时的CSS文件的任何可能性。

答案 1 :(得分:0)

是webpack的一项特殊功能,通常由Angular,React,Vue等最新框架使用。我的意思是用来防止浏览器缓存。但是只有在必要时文件才会更新。

实际上是一种工具。

相关问题